Props.route.params is not changed by clicking on Drawer Navigation item

Asked

Viewed 14 times

0

I’m having the following problem using React Navigation (version 5.x):

I have a Drawer Navigation where I use two routes, one of Home and one of Registration/ Details. How I use the Register screen to both Create and edit, what changes is a parameter that is passed by clicking on an item of the Home screen, where it calls navigation.navigate('Cadastro', {user.id}) and the value is recovered in the Registration screen with props.route.params.

But assuming the following situation:

  • I clicked on a user of the list in the Home
  • I was redirected to the Register screen with the user id and all information related to it was loaded
  • I went back to Home screen
  • I went to the Register screen through the item in the Drawer Menu

In the last action is when the error occurs, because the props.route.params is not changed when I click on the item in the Drawer menu, so I go back to the Register screen with the same previous information. How could I get around that?

OBS: I tried to use the unmountOnBlur: true in the creation of Drawer.Screen, but even the component rendering again, props.route.params is not changed.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.