The scenario:
For both iOS and Android, capture a "call-end" (hangup) event.
Use the captured event to trigger an options window.
What would the differences be to do this using Ionic, React Native, NativeScript, and Flutter?
Implementing a feature for Ionic, ReactNative, and Flutter are more or less same. You must probably write a plugin where you will have to implement the feature in native languages (Objective C / Java) and interface them with JavaScript for Ionic & ReactNative / Dart for Flutter.
But it's quite different with NativeScript as it has a JavaScript runtime that has 100% access to all device apis. You may write a plugin if you are willing to reuse the code or just directly access any api within your project using just JavaScript. If you use TypeScript, life will be even more easier with the typings for all the native apis.
Here is a video that briefly discusses the differences between these platforms.
Related
I'm building a React Native App for a Chinese Company. I'm using Expo.
I really would love to use Google Maps, but it is not allowed there...
The best solution I found was to use Baidu Map,
I searched for SDKs and found some of them in GitHub.
I decided to use this one: https://github.com/qiuxiang/react-native-baidumap-sdk
which provides great documentation.
Although, I'm having some trouble implementing it to the app. I think that they don't support expo.
Does anyone here ever have a similar problem?
Or used another map...
Would really save my life!
This library uses native (Android & iOS) SDKs and provides a React Native API on top of them. Expo does not yet support custom native modules, which means you'll have to eject from it to use this package (or any other that uses BaiduMap or other native code).
I'm guessing they probably have a web based JS SDK instead which you could try to integrate into your app via a <WebView /> instead?
So I have a react native app and was hoping if I could use flutter for some components.
We are using redux for state management and was curious if we could use the same redux store for flutter components.
And for persistence we are using realm, was curious if flutter supports realm.
No you can't use flutter component into react native because both are written in different technology language stack.
Flutter is an open-source mobile application framework that works on
a completely different programming language called Dart, While React
Native lets you build mobile apps using only JavaScript.
Dart is based on c/c++, java and supports things like abstraction,
encapsulation, inheritance, and polymorphism. Flutter team picked
Dart because it matched the way they were building user interfaces,
With Dart bridge, the application size is bigger, but it works much
faster. Unlike React Native with Javascript bridge.
Second Redux is an application architecture, made originally for
JavaScript. Redux provide library for both but we can't use same
redux state for react native and flutter. Redux are written
different for both platform with same functionality and
working(state management)
Realm is also a third party plugin which is available for both
platform but we can't share code between both platform.
Can you use libraries like https://github.com/tolu360/react-native-google-places in an Expo project? I assume any npm library is ok to add, but what about libraries like this google places picker that requires post install steps to link the native projects. Are they supported with Expo?
Regular Expo projects are written only in JavaScript and don't support npm packages that contain Objective-C or Java. However, Expo provides an advanced SDK called ExpoKit for when you absolutely need to use custom native code. From the Expo docs:
Normally, Expo apps are written in pure JS and never “drop down”
to the native iOS or Android layer. This is core to the Expo
philosophy and it’s part of what makes Expo fast and powerful to
use.
However, there are some cases where advanced developers need native
capabilities outside of what Expo offers out-of-the-box. The most
common situation is when a project requires a specific Native Module
which is not supported by React Native Core or the Expo SDK.
You could "detach" your Expo project to create Xcode and Android Studio projects that contain ExpoKit. Then you would add custom Objective-C or Java the same way as with any other Xcode or Android Studio project.
However, the Expo docs also warn about some of the downsides of writing custom native code; many features often can be implemented well in JS, allowing you to retain all of the benefits of a standard Expo project.
Warning: We discourage most of our developers from taking this route,
as we believe almost everything you need to do is better accomplished
in a cross-platform way with JS.
Writing in JS enables you to best take advantage of over-the-air code
deployment and benefit from ongoing updates and support from Expo.
You should only do this if you have a particular demand from native
code which Expo won’t do a good job supporting, such as (for
example) specialized CPU-intensive video processing that must happen
locally on the device.
The primary use case is:
When a phone call occurs, I would want to do certain things inside my app after call end. I need this information about call - call length, caller phone number,type of call (in / out).
How I cat do it in RN?
I believe that there is no such API available for React-Native yet. Unless I'm wrong with my previous statement, you would have to write your own Native Modules for Android and iOS and bind them to your React Native project. Writing a native module is pretty simple, especially if you are familiar with the native language and APIs of each platform. Below are the links to the official docs.
Native Modules for Android
Native Modules for iOS
Purely informational question, not really a problem but:
I remember following the instructions and seeing that there were some steps to get the react-native-fbsdk working. These steps involved messing with my android build.gradle and adding the iOS SDK and the info.plist and whatnot. That aside, why doesn't Facebook utilize the javascript SDK? Is it not possible? If so, why is it not possible for Facebook to do this? If it is possible, why did they opt to utilize the both the android and iOS SDK?
One value prop of React Native is that it's not just an HTML 5 website embedded in a native wrapper. It literally uses the native APIs/components, and the same goes for SDKs. Technically, a pure JS SDK could be optimized for a browser experience, rely on window or document, and while the functionality might be able to be executed natively, the polyfills provided in RN might not be enough to cover the implementation. The way it makes API calls are probably different too. The views are different too (no DOM in RN), so that would apply for any SDK views (button?).
I just finished converting an iOS SDK to a React Native package and I feel that the implementation will be more inline with how the original iOS SDK was designed, since it's using those methods under the covers instead of pure JS. JS is just invoking the native methods, not taking over the methods.
Just my $0.02...