Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

using "reactive native" with our existing code

I wrote my app using native method, currently I want to use reactive native in our further development to avoid writing two copies of code for iOS and Android.

The problem is we can't completely rewrite all the code, we want to replace the project piece by piece.

So I am wondering if I can write some views of my project using reactive native and others remain native code that we have used a long time.

If this is possible, is there any existing tutorial about how to do this?

like image 750
Bin Chen Avatar asked Oct 28 '16 11:10

Bin Chen


People also ask

Can I use the same code for react and React Native?

One of the remarkable facts about React-Native is that it's not only about building Native IOS/Android apps, but we can also build web applications using the same code and share more than 50% of codes between React-Native(Mobile) and React(Web) because we use React and JavaScript in both cases.

How do I use native native with React code?

React Native does not expose a JavaScript API to communicate with the native calendar libraries. However, through native modules, you can write native code that communicates with native calendar APIs. Then you can invoke that native code through JavaScript in your React Native application.

How do I open an existing project in React Native?

Running your React Native application On Android, use the Expo Go app to scan the QR code from your terminal to open your project.

Can I switch from react JS to React Native?

As others have mentioned there's no quick way to convert react to react-native. A possible alternative if you want your react app to run on a mobile device without rewriting your codebase is to use Cordova. For fun I ported a react-web app into a mobile app using Cordova in just a few minutes.


2 Answers

You can keep your originally written native code via native modules. You can port your current project pieces by pieces to native modules, then let React-Native have access to it.

I guess best option is, start a new React-Native project and make it access your native modules, you won't have to rewrite everything then.

Here is more info for Android and iOS

like image 93
Tíbó Avatar answered Oct 04 '22 02:10

Tíbó


There is official documentation to this. Checkout:

https://facebook.github.io/react-native/docs/integration-with-existing-apps.html

like image 20
mauron85 Avatar answered Oct 04 '22 04:10

mauron85