Relationship between React Native and Existing iOS Application

I am new to Swift and react to my native one. I am trying to integrate the native response in an existing IOS application, and the documentation is not very clear in one case: let's say I started the application with React Native from appDelegate (something like this)

let rootView: RCTRootView = RCTRootView(bundleURL: jsCodeLocation, moduleName: "MainScreen", initialProperties: nil, launchOptions: launchOptions)
    self.window = UIWindow(frame: UIScreen.mainScreen().bounds)
    let rootViewController: UIViewController = UIViewController()
    rootViewController.view = rootView

    self.window!.rootViewController = rootViewController
    self.rootViewController = rootViewController
    self.window!.makeKeyAndVisible()

works fine, I can see my React Native application, but when I want to go to the native part, to my own screen, it is not very clear how to make this session work. I created my own class of modules, which I can access, for example, from responding to native, but I don’t understand how to call my own view controller, or should I close the rootController reaction or what?

I tried smth like

let vc = FirstViewController()//   delegate.rootViewController!.presentViewController(vc, : true, : )

- , : ? !

+4

Source: https://habr.com/ru/post/1650148/


All Articles