我在第一个屏幕上有此按钮
<Button rounded title='next' onPress= {() => navigate('nextScreen', { text: this.props.navigation.state.params.text, name: this.props.navigation.state.params.name})}>
,我想在nextScreen中显示文本和名称,但没有结果 ,这是代码
<Text style={{direction: 'rtl', fontSize: 15, padding: 5 }}> • {this.props.navigation.state.params.name}- {this.props.navigation.state.params.text} </Text>
答案 0 :(得分:0)
<Button rounded title='next' onPress= {() => navigate('nextScreen', { text: this.props.navigation.state.params.text, name: this.props.navigation.state.params.name})}>
在上面的代码中,您以
发送文本和名称{ text: this.props.navigation.state.params.text, name: this.props.navigation.state.params.name}
检查天气,您将从上一个屏幕获取文本和名称。值不能为空