The `type` property denotes the type of the router. It can be used to verify compatibility of navigation state and the router when rehydrating state, making rehydration more resilient.
It can also help our utilities to detect the type of the navigator to properly implement some functionality. For example, the `useScrollToTop` hook can now know if it's not inside a tab navigator and needs to find the tab navigator in a parent.
The `isFirstRouteInParent` method was added to determine whether the back button should be shown in the header for stack navigator or not.
This was mainly due to the API of the old version of stack whose public API of header didn't have all required info to determine whether it should be shown.
It was probably a mistake to add it, because this method doesn't look at history and so pretty much useless for other navigators which aren't stack.
In the new stack, the header receives a `previous` prop and the `headerLeft` option receives a `canGoBack` prop which can be used for this purpose.
It's also possible to check if a route is the first by doing `navigation.dangerouslyGetState().routes[0].key === route.key`.
So it's time to drop this method.
We now use the `params` of the route to determine `initialRouteName` and `initialParams` of a navigator.
So you can do something like this:
```js
navigation.push('Auth', { name: 'Login', params: { token 'xxx' } })
```
This will navigate to the `Login` screen inside the `Auth` navigator.
Closes#90
This adds ability to specify a custom config to control how to convert between state and path.
Example:
```js
{
Chat: {
path: 'chat/:author/:id',
parse: { id: Number }
}
}
```
The above config can parse a path matching the provided pattern: `chat/jane/42` to a valid state:
```js
{
routes: [
{
name: 'Chat',
params: { author: 'jane', id: 42 },
},
],
}
```
This makes it much easier to control the parsing without having to specify a custom function.