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,'); //获取上页传递的内容