Skip to content

Pass properties from screen to screen or with initialParams #1749

Answered by jamonholmgren
scinfu asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @scinfu ! Great question.

What I recommend is to store those things in your MST store(s) and then retrieve them in the next screen.

rootStore.setValue(42)
navigation.navigate({name: 'First'})

On your FirstScreen:

export const FirstScreen = observer(function FirstScreen() {
  const { value } = useStores()
  useEffect(() => {
  }, [])
  return (
    <Screen style={ROOT} preset="scroll">
      <Text preset="header" text="" />
      <Text> {value} </Text>
    </Screen>
  )
})

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by jamonholmgren
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #1748 on July 30, 2021 21:19.