问题描述
我用 UIViewController
包装了一个React-native页面,并用导航控制器将其推送,但是如何使用react-native JS代码弹出到本机页面?
I wrapped a react-native page with a UIViewController
, and pushed it with a navigation controller, but how can I pop to the native page using the react-native js code?
推荐答案
最简单的方法是在 AppDelegate
上拥有一个引用 UIViewController
的属性,并具有一个根据您的情况,调用本机模块方法( RCT_EXPORT
)调用 dismissViewController
或 presentViewController
.
The simplest way would be to have a property that references your UIViewController
on your AppDelegate
and have a React Native Module method (RCT_EXPORT
) that calls dismissViewController
or presentViewController
, based on your situation.
我建议在这里阅读这篇讨论结合本机iOS视图和React Native的文章:通过React Native利用现有的iOS视图
I would recommend reading this post discussing combining native iOS Views and React Native here: Leverage Existing iOS Views with React Native
这篇关于如何从react-native页面返回到本地视图控制器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!