反射导航标题在drawernavigator中消失

时间:2017-11-06 12:45:02

标签: reactjs navigation-drawer react-navigation

我将react-navigation更新为1.0.0-beta.19,现在我的导航器组件无法正常工作。标题从DrawerNavigator中消失。

奇怪的是我尝试将软件包恢复到以前的版本(1.0.0-beta.13),但它没有修复它。所以它可能与版本更新无关,但这是唯一改变的。

我在node_modules中检查了包,它确实已恢复到以前的版本。

我感到好奇的是我的导航器组件不好或问题出在其他地方?

导航器组件(自下而上):

const AuthStack = StackNavigator({
    login: { screen: LoginScreen }
    ,forgottendPassword: { screen: ForgottenScreen }
}, {
    initialRouteName: 'login'
    ,headerMode: 'none'
});

// HomeScreen with drawer menu
const HomeDrawer = DrawerNavigator({
    home: {
        screen: HomeScreen
        ,navigationOptions: { drawerLockMode: 'locked-closed' }
    }
}, {
    initialRouteName: 'home'
    ,drawerPosition: 'right'
    ,drawerWidth: 300
    ,contentComponent: props => <HomeDrawerMenu {...props} />
});

// Main stack
const MainStack = StackNavigator({
    homeDrawer: {
        screen: HomeDrawer
        ,navigationOptions: ({ navigation }) => ({
            header: <HomeMenu navigate={navigation.navigate} />
        })
    }
    ,partnerList: {
        screen: PartnerListScreen
        ,navigationOptions: ({ navigation }) => ({
            header: <PartnerListMenu navigation={navigation} />
        })
    }
}, {
    initialRouteName: 'homeDrawer'
});

// Root navigator
const Nav = StackNavigator({
    auth: { screen: ({ navigation }) => 
        <AuthStack screenProps={{ rootNavigation: navigation }} />
    }
    ,main: { screen: ({ navigation }) =>
        <MainStack screenProps={{ rootNavigation: navigation }} />
    }
}, {
    initialRouteName: 'auth',
    headerMode: 'none',
});

export default Nav;

的软件包:

  • react - 16.0.0-beta.5
  • react-native - 0.49.3
  • expo - 22.0.0

编辑: 缺少菜单的HomeScreen屏幕截图:

enter image description here

1 个答案:

答案 0 :(得分:1)

不必要的gem install ruby #This will install latest version of ruby 导致了问题。