首页 > react native通过this.props.navigator.push弹出新页面提示错误?

react native通过this.props.navigator.push弹出新页面提示错误?

渲染列表代码:

``

renderBook(book) {
return (
        <TouchableHighlight onPress={
            () => {
                this.props.navigator.push({
                    component:Home
                });
            }
        } 
        underlayColor='#dddddd'>
            <View>
                <View style={styles.container}>
                    <Image
                        source={{uri:book.volumeInfo.imageLinks}}
                        style={styles.thumbnail} />
                    <View style={styles.rightContainer}>
                        <Text style={styles.title}>{book.volumeInfo.title}</Text>
                        <Text style={styles.author}>{book.volumeInfo.authors}</Text>
                    </View>
                </View>
                <View style={styles.separator} />
            </View>
        </TouchableHighlight>
    );
}

其中:

this.props.navigator.push({
            component:Home
});
                    
 这里点击渲染新view提示错误:

Cannot adjust current top of stack beyond available views!

例子是和网上的相同代码,但是在本地跳转的时候就是一直有这个错误,求大家有没有其他的方法,或者解决这个问题谢谢。

检查一下是不是有字拼错了


你弄懂navigator的工作机制了吗?如果弄懂了,稍微查一下就知道问题在哪里了。

代码没全部给出,没人知道问题出在哪里。

【热门文章】
【热门文章】