0

I hope you are doing well.

I had managed to open the native screen from react-native but now want to open the react-native particular screen from native.

any idea?

Tried this

let jsCodeLocation = RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: "index", fallbackResource: nil)
let rootView = RCTRootView(bundleURL:jsCodeLocation as URL?, moduleName: "myapp", initialProperties: nil, launchOptions:nil)

let rootViewController = UIViewController()

rootViewController.view = rootView
self.navigationController?.pushViewController(rootViewController, animated: true)
rmaddy
  • 314,917
  • 42
  • 532
  • 579
seggy
  • 1,176
  • 2
  • 18
  • 38
  • which `Navigation` do u use? – gran33 Aug 10 '19 at 08:25
  • @gran33 Actually I am new in react. Just try this way to navigate if you have any idea please share it. Thanks – seggy Aug 10 '19 at 08:56
  • You should find the top most `UIViewController` (https://stackoverflow.com/questions/6131205/how-to-find-topmost-view-controller-on-ios) then go to its navigation controller and push your new VC on top of it. But, it's bad practice. That's the basic idea. If you'll use `react-navigation` or `react-native-navigation` the above idea won't work. – gran33 Aug 10 '19 at 10:26
  • Yes but I want to push in react-native screen. – seggy Aug 10 '19 at 10:58
  • So my suggestion above will work – gran33 Aug 11 '19 at 07:05

0 Answers0