Commit Graph

182 Commits

Author SHA1 Message Date
Satyajit Sahoo
b5903373ad chore: publish
- @react-navigation/bottom-tabs@6.0.0-next.12
 - @react-navigation/core@6.0.0-next.9
 - @react-navigation/devtools@6.0.0-next.9
 - @react-navigation/drawer@6.0.0-next.11
 - @react-navigation/elements@1.0.0-next.11
 - flipper-plugin-react-navigation@1.1.0
 - @react-navigation/material-bottom-tabs@6.0.0-next.9
 - @react-navigation/material-top-tabs@6.0.0-next.10
 - @react-navigation/native-stack@6.0.0-next.1
 - @react-navigation/native@6.0.0-next.9
 - @react-navigation/routers@6.0.0-next.3
 - @react-navigation/stack@6.0.0-next.18
2021-05-23 08:04:32 +02:00
Satyajit Sahoo
6dc5364089 refactor: drop openByDefault in favor of defaultStatus prop 2021-05-21 14:39:15 +02:00
Satyajit Sahoo
c8dd70a033 chore: publish
- @react-navigation/bottom-tabs@6.0.0-next.4
 - @react-navigation/core@6.0.0-next.2
 - @react-navigation/devtools@6.0.0-next.2
 - @react-navigation/drawer@6.0.0-next.4
 - @react-navigation/elements@1.0.0-next.4
 - @react-navigation/material-bottom-tabs@6.0.0-next.2
 - @react-navigation/material-top-tabs@6.0.0-next.2
 - @react-navigation/native@6.0.0-next.2
 - @react-navigation/routers@6.0.0-next.2
 - @react-navigation/stack@6.0.0-next.9
2021-04-08 06:19:12 +02:00
Satyajit Sahoo
277fec481b chore: fix dist-tag for publishing 2021-04-08 06:14:41 +02:00
Satyajit Sahoo
d85a4fd8ed chore: upgrade expo to SDK 41 2021-04-04 06:41:26 +02:00
Satyajit Sahoo
bfd6eb79c3 chore: publish
- @react-navigation/bottom-tabs@6.0.0-next.1
 - @react-navigation/core@6.0.0-next.1
 - @react-navigation/devtools@6.0.0-next.1
 - @react-navigation/drawer@6.0.0-next.1
 - @react-navigation/elements@1.0.0-next.1
 - @react-navigation/material-bottom-tabs@6.0.0-next.1
 - @react-navigation/material-top-tabs@6.0.0-next.1
 - @react-navigation/native@6.0.0-next.1
 - @react-navigation/routers@6.0.0-next.1
 - @react-navigation/stack@6.0.0-next.1
2021-03-10 05:13:55 +01:00
Satyajit Sahoo
ebcd077626 docs: update links in READMEs 2021-03-10 05:12:24 +01:00
Satyajit Sahoo
0fce8eb2a1 chore: publish
- @react-navigation/bottom-tabs@6.0.0-next.0
 - @react-navigation/core@6.0.0-next.0
 - @react-navigation/devtools@6.0.0-next.0
 - @react-navigation/drawer@6.0.0-next.0
 - @react-navigation/elements@1.0.0-next.0
 - @react-navigation/material-bottom-tabs@6.0.0-next.0
 - @react-navigation/material-top-tabs@6.0.0-next.0
 - @react-navigation/native@6.0.0-next.0
 - @react-navigation/routers@6.0.0-next.0
 - @react-navigation/stack@6.0.0-next.0
2021-03-09 17:51:56 +01:00
Satyajit Sahoo
9fce3a433c chore: upgrade dependencies 2021-03-07 00:28:13 +01:00
Satyajit Sahoo
86e64fdcd8 feat: associate path with the route it opens when deep linking (#9384)
This commit adds a new optional property on the `route` object called `path`.
This property will be added if the screen was opened from a deep link.

Having this property helps with few things:

- Preserve the URL when the path was unmatched, e.g. 404 routes
- Expose the path to the user so they could handle it manually if needed, e.g. open in a webview
- Avoid changing URL if state to path doesn't match current path, e.g. if orders of params change

Fixes #9102
2021-03-05 12:20:35 +01:00
Satyajit Sahoo
61e653d7c4 fix: fix getId being called for incorrect routes. closes #9343 2021-02-21 15:38:53 +01:00
Petra Daneva
52dbe4bd66 feat: add pressColor and pressOpacity props to drawerItem (#8834)
Co-authored-by: Petra Daneva <p.daneva@dineout.bg>
Co-authored-by: Satyajit Sahoo <satyajit.happy@gmail.com>
2021-01-29 17:45:00 +01:00
sharifhh
3367ddf9df fix: fix StackRouter incorrectly handling invalid route if key is present 2021-01-29 17:35:32 +01:00
Satyajit Sahoo
cda6397b89 refactor: don't use a boolean for drawer status
BREAKING CHANGE: Drawer status is now a union ('open', 'closed') instead of a boolean. This will let us implement more types of status in future.

Following this the following exports have been renamed as well:
- getIsDrawerOpenFromState -> getDrawerStatusFromState
- useIsDrawerOpen -> useDrawerStatus
2021-01-15 12:49:20 +01:00
Satyajit Sahoo
15b8bb3458 feat: add a way to specify an unique ID for screens
With this, the user will be able to specify a `getId` function for their screens which returns an unique ID to use for the screen:

```js
<Stack.Screen
  name="Profile"
  component={ProfileScreen}
  getId={({ params }) => params.userId}
/>
```

This is an alternative to the `key` option in `navigate` with several advantages:

- Often users specify a key that's dependent on data already in params, such as `userId`. So it's much easier to specify it one place rather than at every call site.
- Users won't need to deal with generating a unique key for routes manually.
- This will work with other actions such as `push`, and not just navigate.
- With this, it'll be possible to have multiple instances of the screen even if you use `navigate`, which may be desirable in many cases (such as profile screens).
2021-01-14 03:33:44 +01:00
Satyajit Sahoo
802db004ae chore: upgrade dependencies 2021-01-08 13:59:24 +01:00
Satyajit Sahoo
65d8b487f8 chore: upgrade to typescript 4.1 2020-12-03 01:56:28 +01:00
Satyajit Sahoo
8bdc6c6b9b fix: default to backBehavior: firstRoute for TabRouter
BREAKING CHANGE: Returning to first route after pressing back seems more common in apps. This commit changes the default for tab and drawer navigators to follow this common practice. To preserve previous behavior, you can pass backBehavior=history to tab and drawer navigators.
2020-12-02 21:06:32 +01:00
Satyajit Sahoo
7c1cd261bf feat: add a new backBehavior: firstRoute for TabRouter 2020-12-02 20:35:09 +01:00
Satyajit Sahoo
366d0181dc fix: don't merge params on navigation
BREAKING CHANGE: Previous versions of React Navigation merged params on navigation which caused confusion. This commit changes params not to be merged.

The old behaviour can still be achieved by passing `merge: true` explicitly:

```js
CommonActions.navigate({
  name: 'bar',
  params: { fruit: 'orange' },
  merge: true,
})
```
`initialParams` specified for the screen are always merged.
2020-11-11 23:16:03 +01:00
Satyajit Sahoo
b70ba66f24 chore: prepare for 6.x alpha 2020-11-11 22:07:33 +01:00
Satyajit Sahoo
151055cf5a chore: publish
- @react-navigation/bottom-tabs@5.11.0
 - @react-navigation/compat@5.3.8
 - @react-navigation/core@5.14.2
 - @react-navigation/devtools@5.1.16
 - @react-navigation/drawer@5.11.0
 - @react-navigation/material-bottom-tabs@5.3.8
 - @react-navigation/material-top-tabs@5.3.8
 - @react-navigation/native@5.8.8
 - @react-navigation/routers@5.6.2
 - @react-navigation/stack@5.12.5
2020-11-09 20:17:39 +01:00
Satyajit Sahoo
05d4e4d3be refactor: minor tweak 2020-11-09 02:02:43 +01:00
Satyajit Sahoo
50a161dc3d chore: publish
- @react-navigation/bottom-tabs@5.10.7
 - @react-navigation/compat@5.3.7
 - @react-navigation/core@5.14.1
 - @react-navigation/devtools@5.1.15
 - @react-navigation/drawer@5.10.7
 - @react-navigation/material-bottom-tabs@5.3.7
 - @react-navigation/material-top-tabs@5.3.7
 - @react-navigation/native@5.8.7
 - @react-navigation/routers@5.6.1
 - @react-navigation/stack@5.12.4
2020-11-08 09:06:37 +01:00
Satyajit Sahoo
e50c8aa942 refactor: use a regular action for 'resetRoot'
Previously, 'resetRoot' directly performed a 'setState' on the container instead of dispatching an action. This meant that hooks such as listener for 'preventRemove' won't be notified by it. This commit changes it to dispatch a regular 'RESET' action which will behave the same as other actions.
2020-11-07 15:55:48 +01:00
Satyajit Sahoo
1dad338b7a chore: publish
- @react-navigation/bottom-tabs@5.10.6
 - @react-navigation/compat@5.3.6
 - @react-navigation/core@5.14.0
 - @react-navigation/devtools@5.1.14
 - @react-navigation/drawer@5.10.6
 - @react-navigation/material-bottom-tabs@5.3.6
 - @react-navigation/material-top-tabs@5.3.6
 - @react-navigation/native@5.8.6
 - @react-navigation/routers@5.6.0
 - @react-navigation/stack@5.12.3
2020-11-04 22:37:22 +01:00
Satyajit Sahoo
9beca3a802 feat: add a merge option to navigate to control merging params 2020-11-04 22:36:43 +01:00
Satyajit Sahoo
5eee804e7f chore: publish
- @react-navigation/bottom-tabs@5.10.1
 - @react-navigation/compat@5.3.1
 - @react-navigation/core@5.13.1
 - @react-navigation/devtools@5.1.9
 - @react-navigation/drawer@5.10.1
 - @react-navigation/material-bottom-tabs@5.3.1
 - @react-navigation/material-top-tabs@5.3.1
 - @react-navigation/native@5.8.1
 - @react-navigation/routers@5.5.1
 - @react-navigation/stack@5.11.0
2020-10-28 22:21:16 +01:00
Satyajit Sahoo
d26bcc057e fix: improve types for route prop in screenOptions 2020-10-28 22:06:52 +01:00
Satyajit Sahoo
ac11a3bded chore: publish
- @react-navigation/bottom-tabs@5.10.0
 - @react-navigation/compat@5.3.0
 - @react-navigation/core@5.13.0
 - @react-navigation/devtools@5.1.8
 - @react-navigation/drawer@5.10.0
 - @react-navigation/material-bottom-tabs@5.3.0
 - @react-navigation/material-top-tabs@5.3.0
 - @react-navigation/native@5.8.0
 - @react-navigation/routers@5.5.0
 - @react-navigation/stack@5.10.0
2020-10-25 01:38:02 +02:00
Satyajit Sahoo
95600500a4 chore: upgrade depenendecies 2020-10-25 01:28:19 +02:00
Satyajit Sahoo
7f3b27a9ec feat: allow deep linking to reset state (#8973)
Currently when we receive a deep link after the app is rendered, it always results in a `navigate` action. While it's ok with the default configuration, it may result in incorrect behaviour when a custom `getStateForPath` function is provided and it returns a routes array different than the initial route and new route pair.

The commit changes 2 things:

1. Add ability to reset state via params of `navigate` by specifying a `state` property instead of `screen`
2. Update `getStateForAction` to return an action for reset when necessary according to the deep linking configuration

Closes #8952
2020-10-24 15:27:06 +02:00
Satyajit Sahoo
7dc2f5832e feat: improve types for navigation state (#8980)
The commit improves the navigation state object to have more specific types.
e.g. The `routeNames` array will now have proper type instead of `string[]`
2020-10-23 17:06:31 +02:00
Satyajit Sahoo
091b2a2038 fix: handle pushing a route with duplicate key
Currently, stack router adds a duplicate route when pushing a new route with a key that already exists. This is a buggy behaviour since keys need to be unique in the stack.

This commit fixes the behaviour to bring the existing route with the same key to focus (and merge new params if any) instead of adding a duplicate route.
2020-10-09 00:28:45 +02:00
Satyajit Sahoo
e18578f83f chore: publish
- @react-navigation/bottom-tabs@5.9.0
 - @react-navigation/compat@5.2.6
 - @react-navigation/core@5.12.4
 - @react-navigation/devtools@5.1.6
 - @react-navigation/drawer@5.9.1
 - @react-navigation/material-bottom-tabs@5.2.17
 - @react-navigation/material-top-tabs@5.2.17
 - @react-navigation/native@5.7.4
 - @react-navigation/routers@5.4.12
 - @react-navigation/stack@5.9.1
2020-09-23 01:44:39 +02:00
Satyajit Sahoo
2bb6603aa3 chore: upgrade depenendecies 2020-09-23 01:34:55 +02:00
Bartosz Kaszubowski
050447b9ac chore: update docs website URLs to avoid the redirect (#8819) 2020-09-10 13:34:16 +02:00
Satyajit Sahoo
b029e0f660 chore: publish
- @react-navigation/bottom-tabs@5.8.0
 - @react-navigation/compat@5.2.5
 - @react-navigation/core@5.12.3
 - @react-navigation/devtools@5.1.5
 - @react-navigation/drawer@5.9.0
 - @react-navigation/material-bottom-tabs@5.2.16
 - @react-navigation/material-top-tabs@5.2.16
 - @react-navigation/native@5.7.3
 - @react-navigation/routers@5.4.11
 - @react-navigation/stack@5.9.0
2020-08-04 13:28:13 +02:00
Satyajit Sahoo
cd031f0473 chore: upgrade depenendecies 2020-08-04 12:32:11 +02:00
Satyajit Sahoo
1e813dfb5b chore: publish
- @react-navigation/bottom-tabs@5.7.3
 - @react-navigation/compat@5.2.4
 - @react-navigation/core@5.12.2
 - @react-navigation/devtools@5.1.4
 - @react-navigation/drawer@5.8.7
 - @react-navigation/material-bottom-tabs@5.2.15
 - @react-navigation/material-top-tabs@5.2.15
 - @react-navigation/native@5.7.2
 - @react-navigation/routers@5.4.10
 - @react-navigation/stack@5.8.0
2020-07-28 14:08:02 +02:00
Satyajit Sahoo
b70e3fe618 fix: make sure history is correct after rehydration 2020-07-28 11:20:17 +02:00
Tomasz Krzyżowski
1aa8219021 fix: make sure index is correct when rehydrating state for tabs (#8638)
If the state being rehydrated contained multiple `routes` and had an `index`, we incorrectly kept the same index even if the index of the focused route changed in the state after rehydration. This commit ensures that we also adjust the index appropriately according to the new index of the focused route.
2020-07-28 11:13:01 +02:00
Satyajit Sahoo
513482425a chore: publish
- @react-navigation/bottom-tabs@5.7.0
 - @react-navigation/compat@5.2.0
 - @react-navigation/core@5.12.0
 - @react-navigation/devtools@5.1.2
 - @react-navigation/drawer@5.8.5
 - @react-navigation/material-bottom-tabs@5.2.13
 - @react-navigation/material-top-tabs@5.2.13
 - @react-navigation/native@5.7.0
 - @react-navigation/routers@5.4.9
 - @react-navigation/stack@5.7.0
2020-07-10 22:40:45 +02:00
Satyajit Sahoo
374b081b1c fix: only remove non-existed routes from tab history. closes #8567 2020-07-10 21:54:29 +02:00
Satyajit Sahoo
7a74bdb24e test: add test for merging params on navigation 2020-07-09 11:48:48 +02:00
Satyajit Sahoo
7c3a0a0f23 fix: mark some types as read-only 2020-07-09 11:07:14 +02:00
Satyajit Sahoo
978b197446 chore: publish
- @react-navigation/bottom-tabs@5.6.0
 - @react-navigation/compat@5.1.27
 - @react-navigation/core@5.11.0
 - @react-navigation/devtools@5.1.0
 - @react-navigation/drawer@5.8.3
 - @react-navigation/material-bottom-tabs@5.2.11
 - @react-navigation/material-top-tabs@5.2.11
 - @react-navigation/native@5.6.0
 - @react-navigation/routers@5.4.8
 - @react-navigation/stack@5.6.0
2020-06-24 22:29:01 +02:00
Satyajit Sahoo
f00091d7ab refactor: use ts-expect-errpr instead of ts-ignore 2020-06-24 20:07:32 +02:00
Satyajit Sahoo
d2444887be fix: more improvements to types 2020-06-22 11:45:52 +02:00
Satyajit Sahoo
1aadc79fb8 refactor: enforce import type everywhere 2020-06-17 12:05:40 +02:00