looking for some solutions? You are welcome.

SOLVED: How to pass parameters to a component in another screen in Stack Navigation in react-native?

hesam sameni:

I have an index page where there is a list of users , if user clicks on each user it goes to their profile screen , I can pass the id to render the profile screen but the problem is the profile page is made of several components , and I need that received data to be used in components.

Here is how I pass the data to user's profile:

onPress={() => this.props.navigation.navigate('userProfile',{item})}>

Here is how I receive it in userProfile :

<Text>{this.props.navigation.state.params.item.id}</Text>

But I need to receive it in a component that is used in userProfile screen.



Posted in S.E.F
via StackOverflow & StackExchange Atomic Web Robots
Share:

No comments:

Recent