简体   繁体   English

如何从React Native页面快速打开现有ViewController?

[英]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. 我正在现有的iOS应用程序中添加react native,该应用程序部分位于Objective C和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. 我不知道如何从React Native Page快速打开现有的ViewController

I have gone through below link: How to go to specific native view controller from react-native code? 我已经通过以下链接: 如何从react-native代码转到特定的本机视图控制器?

But don't know how to present or instantiate ViewController using RCT_EXPORT_METHOD , RCT_EXPORT_MODULE . 但是不知道如何使用RCT_EXPORT_METHODRCT_EXPORT_MODULE呈现或实例化ViewController Like in Android using @ReactMethod I can easily start new Activity from react native button click. 就像在Android中使用@ReactMethod一样,我可以通过响应本机按钮单击轻松启动新的Activity。 Please help me with how can I open ViewController from react native page. 请帮助我如何从React Native页面打开ViewController

Have you tried this one: https://stackoverflow.com/a/46007680/4189507 ? 您是否尝试过以下一种方法: 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). 我花了几周的时间将react-native与本地iOS和android完全集成(在它们之间传递数据,事件等)。

My current flow: 我目前的流程:

  • running iOS native app with button "go to React-Native app" 运行带有按钮“转到React-Native应用程序”的iOS本机应用程序
  • click on that button will open new Controller with react-native application. 单击该按钮将打开带有react-native应用程序的新Controller。
  • there is a button "go back" which simply closing the "react-native controller". 有一个“返回”按钮,它仅关闭“ react-native控制器”。

You can call native swift / objective-c methods from react-native using RCT_EXPORT_METHOD. 您可以使用RCT_EXPORT_METHOD从react-native调用本机swift / objective-c方法。

Im not sure if this is what you are looking for. 我不确定这是否是您要找的东西。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 从swift类方法打开Viewcontroller(没有Stroyboard) - React native - Open Viewcontroller(no Stroyboard) from swift class method- React native 如何在React Native中使用现有的Swift应用程序? - How to use an existing swift app in react native? 如何使用 ARKit / swift ViewController 创建 React Native 组件? - How to create a React Native component using ARKit / a swift ViewController? 如何在iOS中打开现有的ViewController - How to open an existing viewcontroller in ios 从图库中选择图像后如何打开下一个视图控制器(swift) - How to open next viewcontroller after choosing image from gallery (swift) 如何从另一个ViewController移至现有ViewController - How to move to existing viewcontroller from another viewcontroller 如何从ViewController访问Swift 3中的另一个viewController - How to access from viewController another viewController in Swift 3 Swift-从ViewController Segue到UITabBarController页面 - Swift- Segue to UITabBarController page from ViewController 当主应用程序未打开时,Swift 如何从今天的扩展中打开特定的视图控制器 - Swift how to open specific viewcontroller from today extension when main app is not open 如何使用 swift Viewcontroller 通过编写代码打开 objective-c Viewcontrollerv 页面? - How can I use swift Viewcontroller through write coding to open the objective-c Viewcontrollerv page?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM