Quantcast
Channel: Active questions tagged javascript - Stack Overflow
Viewing all articles
Browse latest Browse all 140847

Stack Navigator in React Native. Error "undefined is not an object (evaluating this.props.navigation)"

$
0
0

It's taking me forever to figure out the obvious, would appreciate some help.

Im using a stack navigator, when a button is pressed it will simply go to another page.

In app.js I created a stack navigator:

const Switcher = createStackNavigator(
  {
    TaskPg: ListScreen,
    AboutPg: AboutScreen
  },
  {
    initialRouteName: "TaskPg",
    defaultNavigationOptions: {
      title: 'BlueList'
    }
  }
)

In the ListScreen there is a button the user can press to go to the about page

<Button
    onPress={() => this.props.navigation.navigate(AboutScreen)}
    title="About App" />

Run code and every time I press the button I get the error undefined is not an object (evaluating this.props.navigation)

here it is in the simulator


Viewing all articles
Browse latest Browse all 140847

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>