Open kasinskas opened 5 years ago
Can you provide some code please?
Sure. I have such route:
const switchNavigator = createSwitchNavigator( { Details: { screen: DetailsScreen, path: 'details/:imdbId' }, ); const AppContainer = createBrowserApp(switchNavigator);
At the details screen user can click on some other recommended movie to see the details of it. So, for example, I need to go from /details/123 to /details/321.
navigation.navigate('Details', { title: movie.Title, imdbId: movie.imdbID, })
Since I'm building on mobile and web at the same time, I'm trying to reuse as much code as possible. That's why I tried to use navigation.push, but it doesn't exist.
navigation.navigate works in other cases, but here it doesn't re-render the page - imdbId in the url changes, but screen doesn't. I've also tried passing an unique key with no success. Dispatching a push action also doesn't work.
Should I just check if the url changed and rerender the page, or is there a better way?
How can I navigate to the same route when passing different params? navigation.navigate doesn't re-render the page.