zo_*_*chu 5 ios swift react-native
我对 Swift 还很陌生,并且对本机做出了反应。我正在尝试将 React Native 集成到现有的 IOS 应用程序中,并且文档在某一点上不是很清楚:假设我从 appDelegate 使用 React Native 启动了一个应用程序(就像那样)
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()
Run Code Online (Sandbox Code Playgroud)
完美运行,我可以看到我的 React Native 应用程序,但是当我想转到本机部分,本机屏幕时,不太清楚如何使此转场工作。我创建了一个本地模块类,我可以从 react native 访问它,但我不明白如何从那里调用本地 View 控制器,或者我应该关闭 react rootController 还是什么?
我试过了
let vc = FirstViewController() //目标控制器 delegate.rootViewController!.presentViewController(vc, animation: true, completion: nil)
这个不知何故不初始化按钮和东西,并给了我很多 nils 所以我的问题是如何从反应到原生并返回?任何提示都会非常有帮助!
| 归档时间: |
|
| 查看次数: |
584 次 |
| 最近记录: |