Reputation: 671
I am making my first React Native App and I got this error: Undefined is not an object (evaluating "this.props.navigation.navigate")
at this part of the code:
export default class HomeScreen extends React.Component {
render() {
const {navigate} = this.props.navigation;
return (
<View style={styles.container}>
<Text>choose festival</Text>
<Button
title="Select SummerBurst 2017"
onPress={() =>
this.props.navigation.navigate('FestivalScreen', { name: 'SummerBurst' })
}
/>
</View>
);
}
}
I think this is because I don't pass down the react-navigation props, but I don't really know how to do this. My repo looks like this: https://github.com/meurling/festivalApp
Thank you!
Upvotes: 0
Views: 390
Reputation: 820
I think, if you want to learn first using react-navigation
on ReactNative. You follow this tutorial :
And then, if you already understand the flow of react-navigation
. You can play and combine with your idea.
just suggest for you. i hope can help you to easy learning this library.
About your problem, because there are steps you miss, maybe...keep fighting!! keep coding!! cahyooo..
Upvotes: 1