I'm using react-navigation to navigate screens in app. In normal I can use props navigation.navigate to transit to other screen well.
But when I try ListItem, use onPress function not transit to other screen. I tried console.log in onPress and it show, but still not transit screen.
Here my code:
class App extends Component {
goToOtherScreen() {
this.props.navigation.navigate('OtherScreen');
}
render() {
return (
<List>
<ListItem
onPress={() => this.goToOtherScreen()}
... />
</List>
);
}
Oh I just found the problem that I set two screens with same name in StackNavigator.
Most helpful comment
Oh I just found the problem that I set two screens with same name in StackNavigator.