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

6axter82 picture 6axter82  路  3Comments

Slapbox picture Slapbox  路  3Comments

guitar9 picture guitar9  路  3Comments

xavier-villelegier picture xavier-villelegier  路  3Comments

iRoachie picture iRoachie  路  3Comments