React Navigation:如何在堆栈导航器中禁用选项卡导航器滑动

时间:2018-03-27 02:59:44

标签: reactjs navigation swipe react-navigation

Android上的React导航: 在堆栈导航器中,如何禁用滑动选项卡导航器。 THX

2 个答案:

答案 0 :(得分:1)

ABCNav.navigationOptions = ({ navigation, screenProps }) => {
    if (navigation.state.index != 0) {
        return {
            tabBarVisible: false,
            swipeEnabled: false, //disable swipe inside StackNavigator
        };
    }
    return {
        tabBarVisible: true, 
//enable swipe function for first screen
    };
};

答案 1 :(得分:0)

将此添加到StackNavigator中的每个屏幕:

static navigationOptions = {
  swipeEnabled: false,
}