You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: versioned_docs/version-7.x/drawer-navigator.md
+127-38
Original file line number
Diff line number
Diff line change
@@ -220,18 +220,6 @@ When this is set to `open`, the drawer will be open from the initial render. It
220
220
221
221
Boolean used to indicate whether inactive screens should be detached from the view hierarchy to save memory. This enables integration with [react-native-screens](https://github.com/software-mansion/react-native-screens). Defaults to `true`.
222
222
223
-
#### `useLegacyImplementation`
224
-
225
-
Whether to use the legacy implementation based on Reanimated 1. The new implementation based on Reanimated 2 will perform better, but you need additional configuration and need to use Hermes with Flipper to debug.
226
-
227
-
This defaults to `true` in the following cases:
228
-
229
-
- Reanimated 2 is not configured
230
-
- App is connected to Chrome debugger (Reanimated 2 cannot be used with Chrome debugger)
231
-
- App is running on Web
232
-
233
-
Otherwise, it defaults to `false`
234
-
235
223
#### `drawerContent`
236
224
237
225
Function that returns React element to render as the content of the drawer, for example, navigation items
@@ -294,30 +282,6 @@ The `DrawerItem` component accepts the following props:
294
282
-`labelStyle`: Style object for the label `Text`.
295
283
-`style`: Style object for the wrapper `View`.
296
284
297
-
The `progress` object can be used to do interesting animations in your `drawerContent`, such as parallax motion of the drawer contents:
298
-
299
-
<sampid="animated-drawer-content" />
300
-
301
-
```js
302
-
functionCustomDrawerContent(props) {
303
-
constprogress=useDrawerProgress();
304
-
305
-
// If you are on react-native-reanimated 1.x, use `Animated.interpolate` instead of `Animated.interpolateNode`
The `progress` object is a Reanimated `Node` if you're using Reanimated 1 (see [`useLegacyImplementation`](#uselegacyimplementation)), otherwise a `SharedValue`. It represents the animated position of the drawer (0 is closed; 1 is open).
320
-
321
285
Note that you **cannot** use the `useNavigation` hook inside the `drawerContent` since `useNavigation` is only available inside screens. You get a `navigation` prop for your `drawerContent` which you can use instead:
322
286
323
287
```js
@@ -671,7 +635,132 @@ Navigates to an existing screen in the drawer navigator. The method accepts the
671
635
navigation.jumpTo('Profile', { owner:'Satya' });
672
636
```
673
637
674
-
## Checking if the drawer is open
638
+
### Hooks
639
+
640
+
The drawer navigator exports the following hooks:
641
+
642
+
#### `useDrawerProgress`
643
+
644
+
This hook returns the progress of the drawer. It is available in the screen components rendered by the drawer navigator as well as in the [custom drawer content](#drawercontent).
645
+
646
+
The `progress` object is a `SharedValue` that represents the animated position of the drawer (`0` is closed; `1` is open). It can be used to animate elements based on the animation of the drawer with [Reanimated](https://docs.swmansion.com/react-native-reanimated/):
0 commit comments