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

Multi tool use
Multi tool use


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, and that your continued use of the website is subject to these policies.

wv3b 1QuYq,L1xgOpdeBwuND4AXLkGI
xOzuZ Oxr2hzqxv,VWmM7nFsmnZICz6J JGYVW5 gR

Popular posts from this blog

The Dalles, Oregon

영화 미래의 미라이 다시보기 (2018) 다운로드 링크 무료보기

Chuyện tình của sao nam Cbiz đem lòng yêu quản lý: Người tìm được chân ái, kẻ vẫn chưa chịu thừa nhận