简体   繁体   中英

React Navigation: navigate from children

I am in a situation where I need to navigate from a child of StackNavigator . How is this typically achieved? Does the this.props.navigation.navigate have to be passed down as props or is there an other way to do it. Something along the lines of React Router's withRouter HOC?

The navigation prop is only available for the navigation-aware components which are the 'screen's. You can pass the navigation object down to child components as props or you can add the child component as a screen to the StackNavigator.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM