简体   繁体   中英

Integrate a React Native app in to an existing iOS Obj-C/Swift App

https://facebook.github.io/react-native/docs/embedded-app-ios.html#content

This facebook guide and other resources online seem to have the same current implementation guidelines. Something that seems pretty insane, and not something I'm looking to do for my react-native app.

Basically, my goal is to create a simple react-native app in a separate repo and dev space, build/bundle the JS in to the main.jsbundle file and have my current iOS application pull that script and use it on deployments.

In this case, all that is required in my old codebase is a simple wrapper function that launches the react-native app when requested, otherwise functionality acts as it has always done.

It seems pretty weird to me that people would want to write both types of code inside a single codebase, and that is not my goal.

Has anyone got any insight in to how I would accomplish this task?

My project dirs should look something like this:

iOS/ Project.xcodeproj Project/ AppDelegate.m main.jsbundle React-Native/ iOS/ AppDelegate.m index.ios.js

The main.jsbundle in iOS/ is simply the generated bundle from the react-native project.

There's an "integration with existing app" in the official doc. Looks like the way to go : https://facebook.github.io/react-native/docs/integration-with-existing-apps.html

You should be able to build the bundle outside of your iOS main project and import it later in the process. Everything should be quite easily automated.

https://apphub.io could be also a great solution. They're aa commercial service but also have an opensource self-hostable server.

edit : MS Codepush (part of appcenter) is a great tool as well.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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