rfcs icon indicating copy to clipboard operation
rfcs copied to clipboard

Navigation helper names

Open brentvatne opened this issue 6 years ago • 0 comments

  • navigate: it can be used in a variety of situations, but people learn it first as a way to push a route onto the stack, and the word seems best suited for that case. But you can do all sorts of things with navigate, such as go back (using a key)

  • goBack: we should distinguish between the goBack(null) and goBack() and goBack({key: 'someKey'}) cases with separate helpers with more intention revealing names.

    • goBack() - no key passed in, defaults to the key for the current route
    • goBack(key) - go back from this key to the route before it
    • goBack(null) - let any navigator handle this back action - if the deepest active one is already on index 0, a parent will handle
    • dismiss() - goBack(key) where key is the key of the navigator itself

    this is all a bit confusing, in particular when you want to deal with going back across navigators

brentvatne avatar Jan 26 '18 23:01 brentvatne