无法在React Navigation v2中隐藏createBottomTabNavigator

时间:2018-06-20 23:30:18

标签: react-native react-navigation expo

试图在我的应用程序中的特定屏幕上隐藏createBottomTabNavigator。 (反应导航第2版)

我正在通过重置堆栈导航到我想隐藏的路线:

const test = StackActions.reset({
    index: 0,
    actions: [NavigationActions.navigate({ routeName: 'TEST_SCREEN' })],
});

this.props.navigation.dispatch(test);

然后在TestScreen组件中尝试以下操作:

static navigationOptions = ({ navigation }) => {
let tabBarVisible = true;
console.log(navigation.state);
if (navigation.state.routeName === 'TEST_SCREEN') {
  tabBarVisible = false;
}

return {
  tabBarVisible
 };
}

// static navigationOptions = {
 // tabBarVisible: false
// }

console.log输出:

Object {params: undefined, routeName: "TEST_SCREEN", key: "id-1524534842146-12"}
key: "id-1524534842146-12"
params:undefined
routeName: "TEST_SCREEN"
__proto__: Object

我似乎只能找到的信息是https://github.com/react-navigation/react-navigation/issues/1949并且它已经过时(反应导航v1)

有想法吗?

0 个答案:

没有答案