Commit Graph

1382 Commits

Author SHA1 Message Date
Dulmandakh
28fac3e0b9 chore: set displayName for LinkingContext (#9202)
Co-authored-by: Satyajit Sahoo <satyajit.happy@gmail.com>
2021-01-14 12:04:14 +01:00
Dulmandakh
a8b8c27174 chore: set displayName for ThemeContext (#9201)
Co-authored-by: Satyajit Sahoo <satyajit.happy@gmail.com>
2021-01-14 12:03:55 +01:00
Satyajit Sahoo
b19f76bfff 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:52:12 +01:00
Nick McCurdy
365a2ad28c chore: format MaterialBottomTabView.tsx 2021-01-14 03:47:35 +01:00
Satyajit Sahoo
b26b90706f fix: support sync getInitialURL in native useLinking 2021-01-13 22:04:16 +01:00
Satyajit Sahoo
47f28558d6 chore: fix listing packages in metro config 2020-12-17 15:30:36 +01:00
Satyajit Sahoo
26074a28f7 fix: handle fallback for MaterialCommunityIcons better 2020-12-17 15:30:14 +01:00
Satyajit Sahoo
6fe1d70c6c test: add tests for openByDefault in drawer 2020-12-17 15:29:16 +01:00
Satyajit Sahoo
77fa6fb683 chore: migrate to react-native-builder-bob 2020-12-17 15:23:54 +01:00
Sekonia Software Solutions
2ad61a6735 fix: consider openByDefault prop when rehydrating drawer state (#9099)
Co-authored-by: Johannes Huber <jh@sekonia.com>
Co-authored-by: Satyajit Sahoo <satyajit.happy@gmail.com>
2020-12-17 15:23:28 +01:00
Satyajit Sahoo
c9a5d45324 feat: expose getActionForState in linking 2020-12-13 03:06:42 +01:00
Satyajit Sahoo
3c874191ff feat: add a new backBehavior: firstRoute for TabRouter 2020-12-03 02:11:05 +01:00
Satyajit Sahoo
2317633652 fix: print an error when passing a second argument to useFocusEffect 2020-12-02 20:25:25 +01:00
Satyajit Sahoo
74d368eb4d chore: fix typo in workflow 2020-11-28 19:02:51 +01:00
Satyajit Sahoo
d617ab82f9 chore: bump github scripts 2020-11-28 14:35:19 +01:00
Satyajit Sahoo
f5fd0e5be4 chore: add a label for first pull request 2020-11-28 14:33:19 +01:00
Satyajit Sahoo
7bef138e3d chore: only count repro from user's github repos 2020-11-28 14:24:54 +01:00
Satyajit Sahoo
1406eb83ed chore: publish
- @react-navigation/stack@5.12.8
@react-navigation/stack@5.12.8
2020-11-21 05:32:53 +01:00
Satyajit Sahoo
3e069b718d fix: force dismiss keyboard if there was no gesture
closes #9078
2020-11-21 05:32:00 +01:00
Satyajit Sahoo
7754eb450f chore: publish
- @react-navigation/bottom-tabs@5.11.2
 - @react-navigation/compat@5.3.10
 - @react-navigation/core@5.14.4
 - @react-navigation/devtools@5.1.18
 - @react-navigation/drawer@5.11.4
 - @react-navigation/material-bottom-tabs@5.3.10
 - @react-navigation/material-top-tabs@5.3.10
 - @react-navigation/native@5.8.10
 - @react-navigation/stack@5.12.7
@react-navigation/bottom-tabs@5.11.2 @react-navigation/compat@5.3.10 @react-navigation/core@5.14.4 @react-navigation/devtools@5.1.18 @react-navigation/drawer@5.11.4 @react-navigation/material-bottom-tabs@5.3.10 @react-navigation/material-top-tabs@5.3.10 @react-navigation/native@5.8.10 @react-navigation/stack@5.12.7
2020-11-20 18:07:07 +01:00
Satyajit Sahoo
95b2599877 fix: fix incorrect state change events in independent nested container
fixes #9080
2020-11-20 18:06:35 +01:00
Satyajit Sahoo
efcfa7121f chore: only match repo links for GitHub in action 2020-11-20 12:03:50 +01:00
Satyajit Sahoo
a8e27ef448 chore: fix typo in github workflow 2020-11-16 15:33:46 +01:00
Satyajit Sahoo
946d2923d7 chore: publish
- @react-navigation/drawer@5.11.3
@react-navigation/drawer@5.11.3
2020-11-16 02:01:44 +01:00
Satyajit Sahoo
794339eeed fix: hide drawer's header by default 2020-11-16 02:00:05 +01:00
Satyajit Sahoo
53141a6436 chore: add action to check for repro 2020-11-14 20:53:56 +01:00
Satyajit Sahoo
a2337648bf chore: publish
- @react-navigation/bottom-tabs@5.11.1
 - @react-navigation/compat@5.3.9
 - @react-navigation/core@5.14.3
 - @react-navigation/devtools@5.1.17
 - @react-navigation/drawer@5.11.2
 - @react-navigation/material-bottom-tabs@5.3.9
 - @react-navigation/material-top-tabs@5.3.9
 - @react-navigation/native@5.8.9
 - @react-navigation/stack@5.12.6
@react-navigation/compat@5.3.9 @react-navigation/core@5.14.3 @react-navigation/devtools@5.1.17 @react-navigation/drawer@5.11.2 @react-navigation/material-bottom-tabs@5.3.9 @react-navigation/material-top-tabs@5.3.9 @react-navigation/native@5.8.9 @react-navigation/stack@5.12.6 @react-navigation/bottom-tabs@5.11.1
2020-11-10 20:41:26 +01:00
Satyajit Sahoo
8f764d8b08 fix: improve the error message for incorrect screen configuration 2020-11-10 20:29:59 +01:00
Satyajit Sahoo
f8e998b10c refactor: simplify getStateFromPath 2020-11-10 19:44:00 +01:00
Satyajit Sahoo
da35085f1e fix: make sure inactive screen don't increase scroll area on web 2020-11-10 18:21:36 +01:00
Satyajit Sahoo
1f5fb5481a chore: publish
- @react-navigation/drawer@5.11.1
@react-navigation/drawer@5.11.1
2020-11-09 20:40:11 +01:00
Satyajit Sahoo
18bbd177d9 fix: provide correct context to drawe header 2020-11-09 20:37:26 +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
@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
52172453df fix: try fixing drawer blink on Android 2020-11-09 20:05:27 +01:00
Satyajit Sahoo
7bc385e4f3 chore: show header in drawer by default 2020-11-09 19:36:36 +01:00
Satyajit Sahoo
6ac4d40140 feat: add a tabBarBadgeStyle option to customize the badge 2020-11-09 19:28:49 +01:00
Satyajit Sahoo
dbe961ba5b feat: add option to show a header in drawer navigator screens
This commit adds new `header` and `headerShown` options in drawer navigator to be able to show a header, along with a bunch of header related options similar to stack navigator.

Historically, we have suggested to nest a stack navigator inside drawer navigator to render a header. While it works, it's not efficient to nest an entire navigator just for a header, considering it adds a lot of additional overhead from the code to handle animations, gestures etc. which won't ever be run in this case. It also increases the view hierarchy which has negative impacts on performance on Android, and could cause content not to render on older iOS devices.

Another issue with the approach is that since drawer navigator is at the root in this setup, it's possible to open drawer from every screen in the stack navigator, which usually isn't the expected behaviour. It's necessary to write additional code to disable the gesture to open drawer in all screens but first.

In addition, users also need to add a custom drawer icon to the header manually to be able to toggle the drawer

If drawer navigator could render its own header we'd avoid all these shortcomings as well as make the code simpler.

For now, I have implemented a new `Header` component in drawer since it's way simpler than stack navigator header. Though we may consider creating a shared UI package and add such components there which all our navigators could use.

The `Header` includes a button to toggle the drawer by default, and supports customization options such as showing custom left/right/title components. For this commit, I have kept `headerShown` to `false` by default coz I wasn't sure if it'd be a breaking change to start showing headers in drawers. Probably we can toggle it to `true` by default in next major.
2020-11-09 18:52:24 +01:00
Satyajit Sahoo
05d4e4d3be refactor: minor tweak 2020-11-09 02:02:43 +01:00
Satyajit Sahoo
48b2e77730 fix: throw if the same pattern resolves to multiple screens 2020-11-09 01:56:30 +01:00
Satyajit Sahoo
e08c91ff0a feat: add a hook to get bottom tab bar height
Usage:

```js
import { useBottomTabBarHeight } from '@react-navigation/stack';

// ...

const headerHeight = useBottomTabBarHeight();
```

closes #8037, closes #8536
2020-11-08 20:08:50 +01:00
Satyajit Sahoo
5bd682f0bf feat: add a getIsDrawerOpenFromState utility to drawer 2020-11-08 17:51:13 +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
@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
360b0e9958 fix: tweak error message when navigator has non-screen children 2020-11-07 16:43:45 +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
8f0efc8db5 fix: don't hide child header automatically in stack 2020-11-07 14:39:23 +01:00
Satyajit Sahoo
7de6677e72 chore: fix statusbar height in modal example 2020-11-07 00:34:25 +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
@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
ce7d20e336 fix: disable react-native-screens on iOS for older versions 2020-11-04 22:36:43 +01:00
Satyajit Sahoo
e3e58c2d89 feat: add a NavigatorScreenParams type. closes #6931 2020-11-04 22:36:43 +01:00
Satyajit Sahoo
cb2e744dce fix: always respect key in the route object when generating action 2020-11-04 22:36:43 +01:00