Home > Enterprise >  How to make navigation.navigate to navigate. to the same screen
How to make navigation.navigate to navigate. to the same screen

Time:12-31

I have a product screen that shows the details of the product. i.e. "Product Details" and it also shows similar products and upon selecting one of the similar products I want to navigate to the same screen but this time the information will be different.

I'm using context API to update the latest selected product and that's how I'm rendering different information on the same screen.

storeContext.setSelectedProduct(porduct)
navigation.navigate("Product Details")

Is there a way to make it work? I am not sure what more details I should share.

CodePudding user response:

you can re-render the screen again with different data-set or you can use push method of react-navigation to achieve your task.

CodePudding user response:

You can use navigation.push("Product Details") to add the same screen to stack and you can also navigate back to the previous "Product Details" screen using this method.

And then whatever extra details you want to pass can be passed with the navigation function or fetched inside the component using the api methods.

CodePudding user response:

Solution:

navigation.push("Product Details")

You Can check here best Example
Read Official Doc

  • Related