React-native-elements: Navigate to other screen when press ListItem

Created on 27 May 2017  路  1Comment  路  Source: react-native-elements/react-native-elements

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>
        );
}

Most helpful comment

Oh I just found the problem that I set two screens with same name in StackNavigator.

>All comments

Oh I just found the problem that I set two screens with same name in StackNavigator.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pacozaa picture pacozaa  路  3Comments

kyleatblackfoot picture kyleatblackfoot  路  3Comments

Tonacatecuhtli picture Tonacatecuhtli  路  3Comments

ilkerceng picture ilkerceng  路  3Comments

motogod picture motogod  路  3Comments