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-actions.md
+45-36Lines changed: 45 additions & 36 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,6 +9,8 @@ import TabItem from '@theme/TabItem';
9
9
10
10
`DrawerActions` is an object containing methods for generating actions specific to drawer-based navigators. Its methods expand upon the actions available in [CommonActions](navigation-actions.md).
11
11
12
+
For screens inside a [Drawer Navigator](drawer-navigator.md), drawer actions are available as methods on the `navigation` object.
13
+
12
14
The following actions are supported:
13
15
14
16
## openDrawer
@@ -34,7 +36,7 @@ function HomeScreen() {
34
36
<Button
35
37
onPress={() => {
36
38
// codeblock-focus-start
37
-
navigation.dispatch(DrawerActions.openDrawer());
39
+
navigation.openDrawer();
38
40
// codeblock-focus-end
39
41
}}
40
42
>
@@ -57,6 +59,14 @@ export default function App() {
See [`replace`](stack-actions.md#replace) for more details.
1317
+
1316
1318
#### `push`
1317
1319
1318
1320
Pushes a new screen to the top of the stack and navigate to it. The method accepts the following arguments:
@@ -1324,6 +1326,8 @@ Pushes a new screen to the top of the stack and navigate to it. The method accep
1324
1326
navigation.push('Profile', { owner:'Michaś' });
1325
1327
```
1326
1328
1329
+
See [`push`](stack-actions.md#push) for more details.
1330
+
1327
1331
#### `pop`
1328
1332
1329
1333
Pops the current screen from the stack and navigates back to the previous screen. It takes one optional argument (`count`), which allows you to specify how many screens to pop back by.
@@ -1332,6 +1336,8 @@ Pops the current screen from the stack and navigates back to the previous screen
1332
1336
navigation.pop();
1333
1337
```
1334
1338
1339
+
See [`pop`](stack-actions.md#pop) for more details.
1340
+
1335
1341
#### `popTo`
1336
1342
1337
1343
Navigates back to a previous screen in the stack by popping screens after it. The method accepts the following arguments:
@@ -1347,6 +1353,8 @@ If a matching screen is not found in the stack, this will pop the current screen
1347
1353
navigation.popTo('Profile', { owner:'Michaś' });
1348
1354
```
1349
1355
1356
+
See [`popTo`](stack-actions.md#popto) for more details.
1357
+
1350
1358
#### `popToTop`
1351
1359
1352
1360
Pops all of the screens in the stack except the first one and navigates to it.
@@ -1355,6 +1363,8 @@ Pops all of the screens in the stack except the first one and navigates to it.
1355
1363
navigation.popToTop();
1356
1364
```
1357
1365
1366
+
See [`popToTop`](stack-actions.md#poptotop) for more details.
1367
+
1358
1368
### Hooks
1359
1369
1360
1370
The native stack navigator exports the following hooks:
0 commit comments