チェックした場合、それに応じてセットボタンを呼び出します。
const prevGetStateForAction = Navigator.router.getStateForAction;
Navigator.router.getStateForAction = (action, state) => {
// Do not allow to go back from Login
if (action.type === "Navigation/BACK" && state && state.routes[state.index].routeName === "Login") {
return null;
}
// Do not allow to go back to Login
if (action.type === "Navigation/BACK" && state) {
const newRoutes = state.routes.filter(r => r.routeName !== "Login");
const newIndex = newRoutes.length - 1;
return prevGetStateForAction(action, { index: newIndex, routes: newRoutes });
}
return prevGetStateForAction(action, state);
};
はこれを参照してください。
const canGoBack =
this.props.commandType === 'Push' ||
this.props.commandType === 'ShowModal'
@Siggyありがとうございますが、私の問題は、ブラウザではなく、 'react-native'の' react-native-navigation'ライブラリに固有のものです。もっと明確にするためにタイトルに追加しました。 –