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: docs/navigation-prop.md
+37-19Lines changed: 37 additions & 19 deletions
Original file line number
Diff line number
Diff line change
@@ -105,15 +105,15 @@ navigation.navigate({ key: SCREEN_KEY_A }); // will go to screen A FROM screen D
105
105
106
106
Alternatively, as _screen A_ is the top of the stack, you can use `navigation.popToTop()`.
107
107
108
-
### Replace
108
+
### `replace`
109
109
110
110
Call this to replace the current screen with the given route, with params and sub-action.
111
111
112
112
```js
113
113
navigation.replace(name, params);
114
114
```
115
115
116
-
### Reset
116
+
### `reset`
117
117
118
118
Replace the navigator state to a new state:
119
119
@@ -124,6 +124,41 @@ navigation.reset({
124
124
});
125
125
```
126
126
127
+
### `setParams` - Make changes to route params
128
+
129
+
Firing the `setParams` action allows a screen to change the params in the route, which is useful for updating the header buttons and title. `setParams` works like React's `setState` - it merges the provided params object with the current params.
### `setOptions` - Update screen options from the component
145
+
146
+
The `setOptions` method lets us set screen options from within the component. This is useful if we need to use the component's props, state or context to configure our screen.
Any options specified here are shallow merged with the options specified when defining the screen.
161
+
127
162
## Navigation events
128
163
129
164
Screens can add listeners on the `navigation` prop like in React Navigation. By default, `focus` and `blur` events are fired when focused screen changes:
This method doesn't re-render the screen when the value changes and mainly useful in callbacks. You probably want to use [useIsFocused](use-is-focused.md) instead of using this directly, it will return a boolean a prop to indicating if the screen is focused.
158
193
159
-
### `setParams` - Make changes to route params
160
-
161
-
Firing the `setParams` action allows a screen to change the params in the route, which is useful for updating the header buttons and title. `setParams` works like React's `setState` - it merges the provided params object with the current params.
0 commit comments