React-Native Navigator-this.props.navigation....

时间:2020-12-20 19:00:00
render() {
        return (
            <View>
                <Text>2</Text>
                <Button
                    title = "跳转到指定的页面"
                    onPress = {() => this.props.navigation.push('Profile')}
                />
                <Button
                    title = "跳转到指定的页面"
                    onPress = {() => this.props.navigation.navigate('Home')}
                />
                <Button
                    title = "返回上一个页面"
                    onPress = {() => this.props.navigation.goBack()}
                />

                <Button
                    title = "返回第一个页面"
                    onPress = {() => this.props.navigation.popToTop()}
                />
            </View>
        )
    }