简体   繁体   English

将android项目集成到React Native中

[英]Integrate android project into React Native

i am new to react native...... I had a developed android project and now i want to integrate it into React Native. 我是本机反应的新手……我有一个开发的android项目,现在我想将其集成到React Native中。 how can i import or migrate or integrate it into React native? 如何导入或迁移或集成到React native? any help..........! 任何帮助..........! ie, if i run react-native run-android in command prompt my old Project have to be run. 即,如果我在命令提示符下运行react-native run-android ,则必须运行我的旧项目。 i have tried to import my entire project as a library even then it was running app folder only by default..... In Android folder instead of app folder my_Project have to be come...... 我试图将我的整个项目导入为一个库,即使默认情况下它只在运行app文件夹.....在Android文件夹中,而不是app文件夹my_Project必须到来......

React Native is great when you are starting a new mobile app from scratch. 从头开始新的移动应用程序时,React Native很棒。 However, it also works well for adding a single view or user flow to existing native applications. 但是,它也可以很好地将单个视图或用户流添加到现有的本机应用程序。 With a few steps, you can add new React Native based features, screens, views, etc. 只需几个步骤,您就可以添加基于React Native的新功能,屏幕,视图等。

The keys to integrating React Native components into your Android application are to: 将React Native组件集成到Android应用程序中的关键是:

1.Understand what React Native components you want to integrate. 1.了解要集成哪些React Native组件。

2.Install react-native in your Android application root directory to create node_modules/ directory. 2.在您的Android应用程序根目录中安装react-native来创建node_modules /目录。

3.Create your actual React Native components in JavaScript. 3,在JavaScript中创建实际的React Native组件

4.Add com.facebook.react:react-native:+ and a maven pointing to the react-native binaries in node_modules/ to your build.gradle file. 4.将com.facebook.react:react-native:+和指向node_modules /中的react-native二进制文件的行家添加到build.gradle文件中。

5.Create a custom React Native specific Activity that creates a ReactRootView. 5,创建一个自定义的React Native特定活动来创建一个ReactRootView。

6.Start the React Native server and run your native application. 6.启动React Native服务器并运行您的本机应用程序。

7.Optionally add more React Native components. 7.(可选)添加更多React Native组件。

8.Debug. 8,调试

9.Prepare for deployment. 9.准备部署。

10.Deploy and Profit! 10.部署并获利!

More Detail refereed this link http://facebook.github.io/react-native/releases/0.42/docs/integration-with-existing-apps.html#integration-with-existing-apps 更多详细信息请参考此链接http://facebook.github.io/react-native/releases/0.42/docs/integration-with-existing-apps.html#integration-with-existing-apps

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM