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: README.md
+54-3Lines changed: 54 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@
6
6
7
7
React Navigation integration for React Native's Modal component. This navigator works like a Stack Navigator, but each screen is shown as a modal using the `Modal` component from React Native.
8
8
9
-
> Currently the `presentationStyle` of `pageSheet` and `formSheet` are not usable on iOS because it's impossible to detect when they are closed via gesture. See https://github.com/facebook/react-native/issues/29319
9
+
> Currently the `presentationStyle` of `pageSheet` and `formSheet` are not usable on iOS because it's impossible to detect when they are closed via gesture. See <https://github.com/facebook/react-native/issues/29319>
@@ -51,7 +76,18 @@ The first screen in the stack is always rendered as a normal screen and not as a
51
76
52
77
All of the [props available on `Modal` component](https://reactnative.dev/docs/modal#props) can be specified in [options](https://reactnavigation.org/docs/screen-options) to configure the screens in the navigator, except `visible`, `onDismiss`, `onOrientationChange`, `onRequestClose` and `onShow`.
53
78
54
-
Example:
79
+
With static config API:
80
+
81
+
```js
82
+
Profile: {
83
+
screen: ProfileScreen,
84
+
options: {
85
+
animationType:'fade',
86
+
},
87
+
},
88
+
```
89
+
90
+
With dynamic config API:
55
91
56
92
```js
57
93
<Modal.Screen
@@ -107,7 +143,7 @@ Pushes a new screen to top of the modal stack and navigate to it. The method acc
107
143
-`params` - Screen params to merge into the destination route (found in the pushed screen through `route.params`).
108
144
109
145
```js
110
-
navigation.push('Profile', { owner:'Michaś' });
146
+
navigation.push('Profile', { owner:'Jane' });
111
147
```
112
148
113
149
#### `pop`
@@ -118,6 +154,21 @@ Pops the current screen from the modal stack and navigates back to the previous
118
154
navigation.pop();
119
155
```
120
156
157
+
### `popTo`
158
+
159
+
Navigates back to a previous screen in the stack by popping screens after it. The method accepts the following arguments:
160
+
161
+
-`name` - string - Name of the route to navigate to.
162
+
-`params` - object - Screen params to pass to the destination route.
163
+
-`options` - Options object containing the following properties:
164
+
-`merge` - boolean - Whether params should be merged with the existing route params, or replace them (when navigating to an existing screen). Defaults to `false`.
165
+
166
+
If a matching screen is not found in the stack, this will pop the current screen and add a new screen with the specified name and params.
167
+
168
+
```js
169
+
navigation.popTo('Profile', { owner:'Jane' });
170
+
```
171
+
121
172
#### `popToTop`
122
173
123
174
Pops all of the screens in the modal stack except the first one and navigates to it.
0 commit comments