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/static-vs-dynamic.md
+57-4Lines changed: 57 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -282,9 +282,62 @@ In addition, if you were using `navigationKey` to remove or remount screens on a
282
282
283
283
## Wrappers around navigators
284
284
285
-
In the dynamic API, it's possible to wrap the navigator component. For example, to add context providers or additional UI around the navigator. Since the navigator configuration is not a component in static API, this is not possible.
285
+
In the dynamic API, it's possible to wrap the navigator component. For example, to add context providers or additional UI around the navigator.
286
286
287
-
However, in many cases, it may be possible to achieve the same result by using the [`layout`](navigator.md#layout) property:
287
+
In most cases, it can be done in following ways with the static API:
288
+
289
+
### `layout` on parent screen
290
+
291
+
If the navigator is nested inside a screen in another navigator, you can use the [`layout`](screen.md#layout) property on the screen so it wraps the screen's content which includes the navigator:
There are some subtle differences between the two approaches. A layout is rendered as part of the navigator and has access to the navigator's state and options, whereas a wrapper component is outside the navigator.
363
+
A navigator's layout is rendered as part of the navigator and has access to the navigator's state and options, whereas a wrapper component, or a layout on a parent screen don't.
311
364
312
-
This is also not possible if the wrapper component used props from the parent component. However, you can still achieve this by moving those props to React context.
365
+
With both approaches, you can access the route params of the parent screen with the [`useRoute`](use-route.md) hook.
Copy file name to clipboardExpand all lines: versioned_docs/version-8.x/static-vs-dynamic.md
+57-4Lines changed: 57 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -286,9 +286,62 @@ In addition, if you were using `navigationKey` to remove or remount screens on a
286
286
287
287
## Wrappers around navigators
288
288
289
-
In the dynamic API, it's possible to wrap the navigator component. For example, to add context providers or additional UI around the navigator. Since the navigator configuration is not a component in static API, this is not possible.
289
+
In the dynamic API, it's possible to wrap the navigator component. For example, to add context providers or additional UI around the navigator.
290
290
291
-
However, in many cases, it may be possible to achieve the same result by using the [`layout`](navigator.md#layout) property:
291
+
In most cases, it can be done in following ways with the static API:
292
+
293
+
### `layout` on parent screen
294
+
295
+
If the navigator is nested inside a screen in another navigator, you can use the [`layout`](screen.md#layout) property on the screen so it wraps the screen's content which includes the navigator:
There are some subtle differences between the two approaches. A layout is rendered as part of the navigator and has access to the navigator's state and options, whereas a wrapper component is outside the navigator.
367
+
A navigator's layout is rendered as part of the navigator and has access to the navigator's state and options, whereas a wrapper component, or a layout on a parent screen don't.
315
368
316
-
This is also not possible if the wrapper component used props from the parent component. However, you can still achieve this by moving those props to React context.
369
+
With both approaches, you can access the route params of the parent screen with the [`useRoute`](use-route.md) hook.
0 commit comments