Skip to content

Prevent navigating twice when clicking a button quickly #271

@nihgwu

Description

@nihgwu

When we double-click(or multi-click) a link quickly, it will navigate to the same screen twice, so when we want to goBack, we need click the back button twice to go back to parent screen, that's insane.

I use ExperimentalNavigation before, and if I double-click a link quickly, the app crashes because we are pushing a route with the same key, which is not allowed by ExperimentalNavigation, you can try the UIExplorer to reproduce, so I make a check for it:

  1. newKey == latestKey, ignore this action
  2. routes.contains(newKey), jumpTo(newKey)

Now in react-navigation it won't crash because every time we dispatch a new action, we get a different key

So my propose:

  1. don't generate key if provided in action when dispatching and check for existing
  2. generate key according to route params, but I'm afraid that will be buggy because the screen relies on more params expect routeParams

Any thoughts on this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions