I have a list of products and need to navigate to each product from that list and show data passed from HomeScreen do DetailsScreen.I\'m trying to navigate between screens using
Assuming that your data is being passed as the navigation and the components are connected, and your Item Component is your DetailsScreen therefore you can do the following
openDetails = (data) => {
this.props.navigation.navigate("Details", {
data <== // ... pass the item data here
});
};
- this.openDetails(item)} // Get the item data by referencing as a new function to it
itemUrl={item.imageUrl}
data={this.state.data}
/>
DetailsScreen.js
Wrap your view in TouchableOpacity
to access Touchable
events
//... Bind the openDetails function to the prop here
{JSON.stringify(this.props.itemTitle)} //...<== Access the other props here