Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 249
sagarchavan Avatar asked Oct 20 '25 11:10

sagarchavan


1 Answers

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.

like image 131
Artur Schroeder Avatar answered Oct 22 '25 23:10

Artur Schroeder



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!