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

navigation.push is not a function #16

Open

Description

@kasinskas

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

Activity

  1. satya164 commented on Mar 2, 2019

    @satya164
    Member

    Can you provide some code please?

  2. kasinskas commented on Mar 2, 2019

    @kasinskas
    Author

    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 join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions