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

前端 未结 13 1700
说谎
说谎 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:43

    when you defined screen in createStackNavigator , it by default pass a props called navigation, something like this => navigation={this.props.navigation}

    but when you using this.props.navigation.navigator("YOUR SCREEN ") and didn't defined this screen at createStackNavigator you must pass the navigation={this.props.navigation} form the screen that you defined in createStackNavigator and then you can use it in your component .

提交回复
热议问题