1.push传值
this.props.nav.push({
id:'push',
component: Findss,
title:'标题',
});
2. 接收 //设置默认值
constructor(props){
super(props);
this.state ={
title:null,
id:null
};
}
componentDidMount()
{
//这里获取传过来的值
this.setState({
title:this.props.title,
id:this.props.id,
});
}
显示 <Text style = {styles.text}>{this.state.title}</Text>
但是第二个页面显示不出来传过来的title ,不知道为什么,是这个值没传过来吗?有没有大神知道,跪求。
this.props.nav.push({
id:'push',
component: Findss,
title:'标题',
});
2. 接收 //设置默认值
constructor(props){
super(props);
this.state ={
title:null,
id:null
};
}
componentDidMount()
{
//这里获取传过来的值
this.setState({
title:this.props.title,
id:this.props.id,
});
}
显示 <Text style = {styles.text}>{this.state.title}</Text>
但是第二个页面显示不出来传过来的title ,不知道为什么,是这个值没传过来吗?有没有大神知道,跪求。