-
-
Notifications
You must be signed in to change notification settings - Fork 5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: wrong setParams type if route does not have params (#10512)
If a RouteList type has a route with params set to undefined, for example: ```ts type ExampleRouteList = { HasArgs: {someArg?: string}; NoArgs: undefined; }; ``` Then `navigation.setParams` for `NoArgs` would be typed as `(params: Partial<unknown>): void`, since `NavigationProp` would type it as `(params: Partial<RouteList[RouteName]>): void`. This would cause issues with `CompositeScreenProps` because a route with `undefined` params would not extend the `NavigationProp` type correctly, so that screen would not actually get all the options the parent navigators have available. Conditionally setting `setParams` to `undefined` if `RouteList[RouteName]` extends `undefined` fixes this issue.
- Loading branch information
Showing
2 changed files
with
69 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters