Posts

Showing posts with the label react-navigation

undefined is not an object (evaluating '_this.props.navigation.navigate')

This was working fine within the Login.js component: But when i move this to a separated component i receive the error in the title of this post. SocialFooter.js: I've tried adding const { navigation:navigate } = this.props; within the onPress method, also i tried binding this in the constructor, like: this.onPressSocialButton = this.onPressSocialButton.bind(this); Nothing worked, please help me. thanks! Solved by adding: const { navigation } = this.props; in the parent component's render() method (Login.js) then i passed it to the child component like this: Navigation prop is only supplied to the react-navigation screens which you have already configured, if you need to use the navigation prop in any other components, you need to pass it as a prop <SocialFooter navigation={navigation}/> By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy...