如何从react-native页面返回到本地视图控制器? [英] How can I go back to native view controller from react-native page?

查看:86
本文介绍了如何从react-native页面返回到本地视图控制器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用 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的文章:

I would recommend reading this post discussing combining native iOS Views and React Native here: Leverage Existing iOS Views with React Native

这篇关于如何从react-native页面返回到本地视图控制器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆