Getting undefined is not an object evaluating _this.props.navigation

前端 未结 13 1695
说谎
说谎 2020-12-14 15:19

I\'m using DrawerNavigator and I have 3 pages: Router page, mainScreen and a photos page,
I maked a header navbar are

13条回答
  •  無奈伤痛
    2020-12-14 15:38

    This is how I have done it in React Navigation 2 release: I call the openDrawer() method from a StackNavigator that is a child navigator of the DrawerNavigator.

    This is my DrawerNavigator:

    export const Drawer = DrawerNavigator(
        {
            MyAccount: {screen: TabsStack},
        });
    
    
    export const TabsStack = StackNavigator({
    
        Tabs: {
            screen: Tabs, navigationOptions: ({navigation}) => ({
                headerLeft: (
                     navigation.openDrawer()}>
                        
                    )
            })
    

提交回复
热议问题