React native 将本机推送数据反应到另一屏幕
我是一个新的本地人,我试图将数据从一个屏幕推送到另一个屏幕。我现在有两个屏幕,ProductListing&ProductDetail和一个虚拟条目列表。在我的ProductListing屏幕上,我执行了以下操作:React native 将本机推送数据反应到另一屏幕,react-native,react-native-android,react-native-ios,react-native-navigation,React Native,React Native Android,React Native Ios,React Native Navigation,我是一个新的本地人,我试图将数据从一个屏幕推送到另一个屏幕。我现在有两个屏幕,ProductListing&ProductDetail和一个虚拟条目列表。在我的ProductListing屏幕上,我执行了以下操作: pushProductDetailScreen(item){ this.props.navigator.push({ screen: 'ProductDetail', title: item.name, subtitle: item.type,
pushProductDetailScreen(item){
this.props.navigator.push({
screen: 'ProductDetail',
title: item.name,
subtitle: item.type,
backButtonTitle: '',
data: item
});
};
<FlatList
data={S_Entries}
renderItem={({ item }) => (
<ListItem
roundAvatar
title={item.name}
subtitle={item.type}
avatar={{ uri: item.image }}
containerStyle={{ borderBottomWidth: 0 }}
button onPress={() => {this.pushProductDetailScreen(item)}}
/>
)}
keyExtractor={item => item.id}
/>
在我的ProductDetail屏幕上,我想接收我的项目数组,但不知道如何获取它。使用passProps
ProductListing.js
this.props.navigator.push({
screen: 'ProductDetail',
title: item.name,
subtitle: item.type,
backButtonTitle: '',
passProps: {
data: item
},
});
ProductDetail.js
var data = this.props.data;
完美的非常感谢。