在Android上的Navigator,React Native中处理后退按钮 [英] Handling back button in React Native, Navigator on Android

查看:65
本文介绍了在Android上的Navigator,React Native中处理后退按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Android react本机应用程序中有一个 Navigator .

I have a Navigator in an Android react native application.

我正在使用 navigator.push()导航到另一个页面.后退按钮会弹出导航器并返回一页,这很自然,但这不是正在发生的事情(退出应用程序).

I'm using navigator.push() to navigate to a different page. It would seem natural that the back button would pop the navigator and to go back one page, but that's not what's happening (it quits the app).

react-native Navigator 是否确实不支持后退按钮,我是否需要自己将其插入 BackAndroid ?

Do the react-native Navigator really has no back button support, do I need to plug it myself with a BackAndroid?

推荐答案

是的,您必须自己处理后退按钮.我认为,这样做的主要原因是您可能想使用后退"按钮执行不同的操作,而不是仅仅移回堆栈.我不知道将来是否有计划合并后退按钮功能.

Yes, you have to handle the back button yourself. I think the main reason for this is you may want to do different things with the back button instead of just moving back through the stack. I don't know if there are plans to incorporate back button functionality in the future though.

这篇关于在Android上的Navigator,React Native中处理后退按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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