React Native 通过navigation实现页面间传值

发送页:
this.props.navigation.navigate('BindSubscriptions', { assetId: this.state.assetId })

this.props.navigation.navigate('AssetDetails', {item});

this.props.navigation.navigate('DriveMoreInfo', {
info: this.state.data,
itemId: itemId,
assetType: G_ASSET_TYPE,
assetName: G_ASSET_NAME,
});

 



接收页:
assetId: this.props.navigation.state.params.assetId,

const item = this.props.navigation.getParam('item');
itemId = item.id;


const info = this.props.navigation.getParam('info'); //获取上页传递的内容
itemId = this.props.navigation.getParam('itemId'); //获取上页传递的内容
G_ASSET_TYPE = this.props.navigation.getParam('assetType'); //获取上页传递的内容
G_ASSET_NAME = this.props.navigation.getParam('assetName,'); //获取上页传递的内容

 

posted @ 2020-03-30 15:03  GLORY-HOPE  阅读(738)  评论(0编辑  收藏  举报