Integrate with existing native ios app


#1

Hi, I am trying to integrate my expo react native app with an existing swift ios app.

According to React Native documentation I need to do this:

let jsCodeLocation = URL(string: "http://localhost:8081/index.bundle?platform=ios")
let rootView = RCTRootView(
      bundleURL: jsCodeLocation,
      moduleName: "ModuleName",
      initialProperties: nil,
      launchOptions: nil
  )

The problem is expo gives me an url like: exp://192.168.17.232:19000
And that does not work.

It is also possible to add the file location of the main.jsbundle, except I can’t find such a file.

How do I integrate it with the existing app?


#2

If you change the protocol from exp -> http you’ll get some json that has a bundleUrl field. Is that what you’re looking for?

I’m curious what you’re planning to implement in RN vs swift if you can share.


#3

Hi,

I found that bundle url, and when I input it to the code it gives me some red screen saying The Expo SDK requires Expo to run.

So I tried to add the expo kit to the swift projects Podfile. Still the same message.

I really don’t know what else to try now.

I’ll just say that we have an existing Native ios app, and we want to extend the functionality of that app using React-Native


#4

Hey there, Expo’s native implementation differs significantly from a raw React Native project, so the guide you were following probably doesn’t apply here. As the error message mentioned, you’ll need to have the Expo SDK present in both your JS and in your native code in order to use Expo.

I’d say the easiest way to proceed is:

  • Create a blank Expo project with exp init ...
  • Render a native iOS/Android project with exp detach (and follow this guide to get it running)
  • Compare the result of that with your existing project.

ExpoKit and React Native aren’t currently written to bridge with Swift so I’m not at all sure they’ll work out of the box. So I don’t want to set your expectations high - this may just be a dead end.


#5

Ok, thanks for your reply, We will make a new project with react-native init, and move our code to the new project to be able to integrate with our existing app.


closed #6

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.