I have created an app on react native. There are only 2 activities in it, now I want to integrate them in my existing android app (Native android app).
I came to know that at the core React-native does not provide the functionality of generating .arr
files or native code
. For that we need to use Electrode Native
.
My Question is: Is there any other way of generating native (iOS/android) code from react-native code? Do any other tool exist? If they do, what other features Electrode native
offers to make one consider it?
React Native provides a module that detects the platform in which the app is running. You can use the detection logic to implement platform-specific code. Use this option when only small parts of a component are platform-specific.
Platform.OS will be ios when running on iOS and android when running on Android.
There is also a Platform.select method available, that given an object containing Platform.OS as keys, returns the value for the platform you are currently running on.
This will result in a container having flex: 1 on both platforms, a red background color on iOS, and a blue background color on Android.
Since it accepts any value, you can also use it to return platform specific component, like below:
Detecting the Android version On Android, the Platform module can also be used to detect the version of the Android Platform in which the app is running:
Detecting the iOS version On iOS, the Version is a result of -[UIDevice systemVersion], which is a string with the current version of the operating system. An example of the system version is "10.3". For example, to detect the major version number on iOS: