![](/img/trans.png)
[英]how to hide back button in React-navigation/react-native
[英]React-native navigation is it possible to intercept the back action?
是否可以在任何路線上攔截本機反應的后退動作? 假設我在一個頁面上,當他/她執行返回操作時,我想在不同的路線上導航用戶。
甚至彈出確認。
例如,您可以使用 React 的 [BackHandler][1]
// import the back handler from react-native
import { BackHandler } from 'react-native'
// fire the listener on every render (including the componentWillUnmount)
useLayoutEffect(() => {
BackHandler.addEventListener(
"hardwareBackPress",
{
console.warn('about to go back....')
}
);
}, [])
[1]: https://reactnative.dev/docs/backhandler
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.