问题
I am trying to navigate from one screen to other screen inside tabbar in react native. But, I am getting following error
ButtonClickCheckFunction = () => {
const { navigation } = this.props;
navigation.navigate('detailsScreen', { detailsScreen: jsonData });
}
Any suggestions?
For main screens, In tab bar we have created stack,
const AppStack = createAppContainer(createDrawerNavigator({
Dashboard: {
screen: ProfileStack,
},
Connect: {
screen: Connect,
},
screen1: {
screen: Screen1,
}
});
But, In Dashboard screen we are showing tabbar. I am working with tab2. So, From tab2, I have details screen. In that details screen I have to show navigation bar with back button arrow like custom image.
So, How to fix this?
回答1:
If you post more code, we'll be able to better answer your question.
From the error message though, it seems like you're not properly creating the component so that the navigation
property is set. You'll need to make sure to wrap the component using the withNavigation higher order component.
export default withNavigation(MyComponent);
来源:https://stackoverflow.com/questions/55221232/undefined-is-not-an-object-evaluating-navigation-navigate