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-6.x/drawer-layout.md
+21-21Lines changed: 21 additions & 21 deletions
Original file line number
Diff line number
Diff line change
@@ -105,35 +105,35 @@ The package exports a `Drawer` component which is the one you'd use to render th
105
105
106
106
### `Drawer`
107
107
108
-
Component responsible for rendering a drawer with animations and gestures.
108
+
The `Drawer` component is responsible for rendering a drawer sidebar with animations and gestures.
109
109
110
-
#### Drawer Props
110
+
It accepts the following props:
111
111
112
-
#####`open`
112
+
#### `open`
113
113
114
114
Whether the drawer is open or not.
115
115
116
-
#####`onOpen`
116
+
#### `onOpen`
117
117
118
118
Callback which is called when the drawer is opened.
119
119
120
-
#####`onClose`
120
+
#### `onClose`
121
121
122
122
Callback which is called when the drawer is closed.
123
123
124
-
#####`renderDrawerContent`
124
+
#### `renderDrawerContent`
125
125
126
126
Callback which returns a react element to render as the content of the drawer.
127
127
128
-
#####`layout`
128
+
#### `layout`
129
129
130
130
Object containing the layout of the container. Defaults to the dimensions of the application's window.
131
131
132
-
#####`drawerPosition`
132
+
#### `drawerPosition`
133
133
134
134
Position of the drawer on the screen. Defaults to `right` in RTL mode, otherwise `left`.
135
135
136
-
#####`drawerType`
136
+
#### `drawerType`
137
137
138
138
Type of the drawer. It determines how the drawer looks and animates.
139
139
@@ -144,19 +144,19 @@ Type of the drawer. It determines how the drawer looks and animates.
144
144
145
145
Defaults to `slide` on iOS and `front` on other platforms.
146
146
147
-
#####`drawerStyle`
147
+
#### `drawerStyle`
148
148
149
149
Style object for the drawer. You can pass a custom background color for drawer or a custom width for the drawer.
150
150
151
-
#####`overlayStyle`
151
+
#### `overlayStyle`
152
152
153
153
Style object for the overlay.
154
154
155
-
#####`hideStatusBarOnOpen`
155
+
#### `hideStatusBarOnOpen`
156
156
157
157
Whether to hide the status bar when the drawer is open. Defaults to `false`.
158
158
159
-
#####`keyboardDismissMode`
159
+
#### `keyboardDismissMode`
160
160
161
161
Whether to dismiss the keyboard when the drawer is open. Supported values are:
162
162
@@ -165,7 +165,7 @@ Whether to dismiss the keyboard when the drawer is open. Supported values are:
165
165
166
166
Defaults to `on-drag`.
167
167
168
-
#####`statusBarAnimation`
168
+
#### `statusBarAnimation`
169
169
170
170
Animation to use when the status bar is hidden. Supported values are:
171
171
@@ -175,43 +175,43 @@ Animation to use when the status bar is hidden. Supported values are:
175
175
176
176
Use it in combination with `hideStatusBarOnOpen`.
177
177
178
-
#####`swipeEnabled`
178
+
#### `swipeEnabled`
179
179
180
180
Whether to enable swipe gestures to open the drawer. Defaults to `true`.
181
181
182
182
Swipe gestures are only supported on iOS and Android.
183
183
184
-
#####`swipeEdgeWidth`
184
+
#### `swipeEdgeWidth`
185
185
186
186
How far from the edge of the screen the swipe gesture should activate. Defaults to `32`.
187
187
188
188
This is only supported on iOS and Android.
189
189
190
-
#####`swipeMinDistance`
190
+
#### `swipeMinDistance`
191
191
192
192
Minimum swipe distance that should activate opening the drawer. Defaults to `60`.
193
193
194
194
This is only supported on iOS and Android.
195
195
196
-
#####`swipeMinVelocity`
196
+
#### `swipeMinVelocity`
197
197
198
198
Minimum swipe velocity that should activate opening the drawer. Defaults to `500`.
199
199
200
200
This is only supported on iOS and Android.
201
201
202
-
#####`gestureHandlerProps`
202
+
#### `gestureHandlerProps`
203
203
204
204
Props to pass to the underlying pan gesture handler.
205
205
206
206
This is only supported on iOS and Android.
207
207
208
-
#####`children`
208
+
#### `children`
209
209
210
210
Content that the drawer should wrap.
211
211
212
212
### `useDrawerProgress`
213
213
214
-
The `useDrawerProgress` hook returns a Reanimated SharedValue (with modern implementation) or Reanimated Node (with legacy implementation) which represents the progress of the drawer. It can be used to animate the content of the screen.
214
+
The `useDrawerProgress` hook returns a Reanimated `SharedValue` (with modern implementation) or Reanimated Node (with legacy implementation) which represents the progress of the drawer. It can be used to animate the content of the screen.
Copy file name to clipboardExpand all lines: versioned_docs/version-7.x/drawer-layout.md
+29-48Lines changed: 29 additions & 48 deletions
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ title: React Native Drawer Layout
4
4
sidebar_label: Drawer Layout
5
5
---
6
6
7
-
A cross-platform Drawer component for React Native implemented using [`react-native-gesture-handler`](https://docs.swmansion.com/react-native-gesture-handler/) and [`react-native-reanimated`](https://docs.swmansion.com/react-native-reanimated/).
7
+
A cross-platform Drawer component for React Native implemented using [`react-native-gesture-handler`](https://docs.swmansion.com/react-native-gesture-handler/) and [`react-native-reanimated`](https://docs.swmansion.com/react-native-reanimated/) on native platforms and CSS transitions on Web.
8
8
9
9
<videoplaysInlineautoPlaymutedloop>
10
10
<sourcesrc="/assets/7.x/drawer-layout.mp4" />
@@ -55,7 +55,7 @@ Then, you need to install and configure the libraries that are required by the d
55
55
import'./gesture-handler';
56
56
```
57
57
58
-
Since the drawer layout doesn't use `react-native-gesture-handler` on the web, this avoids unnecessarily increasing the bundle size.
58
+
Since the drawer layout doesn't use `react-native-gesture-handler` on Web, this avoids unnecessarily increasing the bundle size.
59
59
60
60
:::warning
61
61
@@ -106,35 +106,35 @@ The package exports a `Drawer` component which is the one you'd use to render th
106
106
107
107
### `Drawer`
108
108
109
-
Component responsible for rendering a drawer with animations and gestures.
109
+
The `Drawer` component is responsible for rendering a drawer sidebar with animations and gestures.
110
110
111
-
#### Drawer Props
111
+
It accepts the following props:
112
112
113
-
#####`open`
113
+
#### `open`
114
114
115
115
Whether the drawer is open or not.
116
116
117
-
#####`onOpen`
117
+
#### `onOpen`
118
118
119
119
Callback which is called when the drawer is opened.
120
120
121
-
#####`onClose`
121
+
#### `onClose`
122
122
123
123
Callback which is called when the drawer is closed.
124
124
125
-
#####`renderDrawerContent`
125
+
#### `renderDrawerContent`
126
126
127
127
Callback which returns a react element to render as the content of the drawer.
128
128
129
-
#####`layout`
129
+
#### `layout`
130
130
131
131
Object containing the layout of the container. Defaults to the dimensions of the application's window.
132
132
133
-
#####`drawerPosition`
133
+
#### `drawerPosition`
134
134
135
135
Position of the drawer on the screen. Defaults to `right` in RTL mode, otherwise `left`.
136
136
137
-
#####`drawerType`
137
+
#### `drawerType`
138
138
139
139
Type of the drawer. It determines how the drawer looks and animates.
140
140
@@ -145,19 +145,19 @@ Type of the drawer. It determines how the drawer looks and animates.
145
145
146
146
Defaults to `slide` on iOS and `front` on other platforms.
147
147
148
-
#####`drawerStyle`
148
+
#### `drawerStyle`
149
149
150
150
Style object for the drawer. You can pass a custom background color for drawer or a custom width for the drawer.
151
151
152
-
#####`overlayStyle`
152
+
#### `overlayStyle`
153
153
154
154
Style object for the overlay.
155
155
156
-
#####`hideStatusBarOnOpen`
156
+
#### `hideStatusBarOnOpen`
157
157
158
158
Whether to hide the status bar when the drawer is open. Defaults to `false`.
159
159
160
-
#####`keyboardDismissMode`
160
+
#### `keyboardDismissMode`
161
161
162
162
Whether to dismiss the keyboard when the drawer is open. Supported values are:
163
163
@@ -166,7 +166,7 @@ Whether to dismiss the keyboard when the drawer is open. Supported values are:
166
166
167
167
Defaults to `on-drag`.
168
168
169
-
#####`statusBarAnimation`
169
+
#### `statusBarAnimation`
170
170
171
171
Animation to use when the status bar is hidden. Supported values are:
172
172
@@ -176,43 +176,43 @@ Animation to use when the status bar is hidden. Supported values are:
176
176
177
177
Use it in combination with `hideStatusBarOnOpen`.
178
178
179
-
#####`swipeEnabled`
179
+
#### `swipeEnabled`
180
180
181
181
Whether to enable swipe gestures to open the drawer. Defaults to `true`.
182
182
183
183
Swipe gestures are only supported on iOS and Android.
184
184
185
-
#####`swipeEdgeWidth`
185
+
#### `swipeEdgeWidth`
186
186
187
187
How far from the edge of the screen the swipe gesture should activate. Defaults to `32`.
188
188
189
189
This is only supported on iOS and Android.
190
190
191
-
#####`swipeMinDistance`
191
+
#### `swipeMinDistance`
192
192
193
193
Minimum swipe distance that should activate opening the drawer. Defaults to `60`.
194
194
195
195
This is only supported on iOS and Android.
196
196
197
-
#####`swipeMinVelocity`
197
+
#### `swipeMinVelocity`
198
198
199
199
Minimum swipe velocity that should activate opening the drawer. Defaults to `500`.
200
200
201
201
This is only supported on iOS and Android.
202
202
203
-
#####`gestureHandlerProps`
203
+
#### `gestureHandlerProps`
204
204
205
205
Props to pass to the underlying pan gesture handler.
206
206
207
207
This is only supported on iOS and Android.
208
208
209
-
#####`children`
209
+
#### `children`
210
210
211
211
Content that the drawer should wrap.
212
212
213
213
### `useDrawerProgress`
214
214
215
-
The `useDrawerProgress` hook returns a Reanimated SharedValue (with modern implementation) or Reanimated Node (with legacy implementation) which represents the progress of the drawer. It can be used to animate the content of the screen.
215
+
The `useDrawerProgress` hook returns a Reanimated `SharedValue` which represents the progress of the drawer. It can be used to animate the content of the screen.
If you are using class components, you can use the `DrawerProgressContext` to get the progress value.
268
243
269
244
```js
@@ -281,3 +256,9 @@ class MyComponent extends React.Component {
281
256
}
282
257
}
283
258
```
259
+
260
+
:::warning
261
+
262
+
The `useDrawerProgress` hook (or `DrawerProgressContext`) will return a mock value on Web since Reanimated is not used on Web. The mock value can only represent the open state of the drawer (`0` when closed, `1` when open), and not the progress of the drawer.
Copy file name to clipboardExpand all lines: versioned_docs/version-7.x/drawer-navigator.md
+7-1Lines changed: 7 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -762,7 +762,13 @@ export default function App() {
762
762
</TabItem>
763
763
</Tabs>
764
764
765
-
This hook is not supported on Web.
765
+
If you are using class components, you can use the `DrawerProgressContext` to get the progress value.
766
+
767
+
:::warning
768
+
769
+
The `useDrawerProgress` hook (or `DrawerProgressContext`) will return a mock value on Web since Reanimated is not used on Web. The mock value can only represent the open state of the drawer (`0` when closed, `1` when open), and not the progress of the drawer.
0 commit comments