Skip to content
This repository has been archived by the owner on May 20, 2021. It is now read-only.

navigation.push is not a function #16

Open
kasinskas opened this issue Mar 2, 2019 · 2 comments
Open

navigation.push is not a function #16

kasinskas opened this issue Mar 2, 2019 · 2 comments

Comments

@kasinskas
Copy link

How can I navigate to the same route when passing different params? navigation.navigate doesn't re-render the page.

@satya164
Copy link
Member

satya164 commented Mar 2, 2019

Can you provide some code please?

@kasinskas
Copy link
Author

kasinskas commented Mar 2, 2019

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?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants