【发布时间】:2019-12-11 11:44:55
【问题描述】:
我正在尝试处理 android 上的后退按钮,因为我的 React Native 应用程序在为根屏幕按下的后退按钮上有自定义逻辑...有没有像 Navigation.getCurrentRoutes() 这样的方法
为了做这样的事情:
handleBackButton = () => {
if(Navigation.getCurrentRoutes().size()>1) {
return true; // addEventListener listens for the native hardware back button press and will ignore it
}
... customLogic
return false; // will execute the native back press (and exit the app)
}
“react-native-navigation”:“3.0.0-alpha.2”
【问题讨论】:
-
是的,但由于某种原因,在按下 hardwareBackButton 时不会调用 navigationButtonPressed() github.com/wix/react-native-navigation/issues/4231
标签: react-native react-native-navigation wix-react-native-navigation