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
We can also do `exportconstcreateMyNavigator=createNavigatorFactory(MyNavigator)` directly instead of wrapping in another function. However, the wrapper function is necessary to have proper [TypeScript support](#type-checking-navigators) for the navigator.
The type bag must use an `interface` instead of `type` for `this` to work. It also needs to be exported in the public API for type inference to work.
357
+
358
+
:::
359
+
393
360
## Extending Navigators
394
361
395
362
All of the built-in navigators export their views, which we can reuse and build additional functionality on top of them. For example, if we want to re-build the bottom tab navigator, we need the following code:
Copy file name to clipboardExpand all lines: versioned_docs/version-8.x/upgrading-from-7.x.md
+10-44Lines changed: 10 additions & 44 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -165,9 +165,9 @@ This is technically not a breaking change. It's not required to use this API and
165
165
166
166
See [Static configuration docs](static-configuration.md#createxscreen) for more details.
167
167
168
-
#### Custom navigators now require overloads for types
168
+
#### Custom navigators have a simpler type API
169
169
170
-
To work with the reworked TypeScript types, custom navigators now need to provide overloads for static and dynamic configuration APIs, and an additional API to create screen config.
170
+
To work with the reworked TypeScript types, the type API for custom navigators has been updated. The new API uses an interface that extends `NavigatorTypeBagBase`and a pair of factory helpers - `createNavigatorFactory` and `createScreenFactory`:
171
171
172
172
```diff lang=ts
173
173
- export function createMyNavigator<
@@ -192,54 +192,20 @@ To work with the reworked TypeScript types, custom navigators now need to provid
0 commit comments