sagarchavan
sagarchavan

Reputation: 197

How to open existing ViewController in swift from react native page?

I am new to react native. I am adding react native in my existing iOS app which is partially in Objective C and Swift. I have added Native Module support, bridging in existing app. I don't know how to open a existing ViewController in swift from React Native Page.

I have gone through below link: How to go to specific native view controller from react-native code?

But don't know how to present or instantiate ViewController using RCT_EXPORT_METHOD, RCT_EXPORT_MODULE. Like in Android using @ReactMethod I can easily start new Activity from react native button click. Please help me with how can I open ViewController from react native page.

Upvotes: 4

Views: 10248

Answers (1)

Artur Schroeder
Artur Schroeder

Reputation: 243

Have you tried this one: https://stackoverflow.com/a/46007680/4189507 ?

I was manage to do this in my application. It took me a few weeks to fully integrate react-native with native iOS and android (passing data, events etc. between them).

My current flow:

  • running iOS native app with button "go to React-Native app"
  • click on that button will open new Controller with react-native application.
  • there is a button "go back" which simply closing the "react-native controller".

You can call native swift / objective-c methods from react-native using RCT_EXPORT_METHOD.

Im not sure if this is what you are looking for.

Upvotes: 2

Related Questions