native,
在这里,我从第一页获取值。
constructor(){
super();
this.state = {
selectPickup:'',
}
}
ongNavigationDetail = ()=>{
let params = {
pickup : this.state.selectPickup
}
console.log(params)
// send to third page
}
render() {
const userLocation = this.props.navigation.getParam('pickup'); // get value from first page
return (
<CardItem header>
{/* <Text style={{ fontSize: 12}}>{userLocation}</Text> */}
<Input onChangeText={userLocation => this.setState({selectPickup:userLocation})} value={userLocation}/>
</CardItem>
<Button block info style={styles.MainBtn} onPress={this.ongNavigationDetail}>
<Text style={styles.btnText}>Next</Text>
</Button>
)}
在第二页上,这里我取值userLocation发送第三次行程,但当我控制台时,值未被定义,爆炸在哪里?
我认为目前,您的导航对象无法访问getParams
功能。也许你可以像这样简单地访问它。
this.pros.navigation.route.params