i m trying to use react-navigation to implement an onPress handler which allows me to navigate to a screen called tasks
the below code shows the headerRight just fine. however, when i click on the headerRight button, i get the following error
"Undefined is not an object (evaluating _this2.props.navigation) on my expo simulator".
Anyone knows what could have gone wrong with my onPress handler? Tq
static navigationOptions = {
title: 'List',
headerRight: (
<Button
title='Add Task'
onPress={() => this.props.navigation.navigate('task')}
backgroundColor='rgba(0,0,0,0)'
color='rgba(0,122,255,1)'
/>)
}