diff --git a/native/chat/chat.react.js b/native/chat/chat.react.js --- a/native/chat/chat.react.js +++ b/native/chat/chat.react.js @@ -144,6 +144,7 @@ initialRouteName, children, screenOptions, + screenListeners, id, ...rest }: ChatNavigatorProps) { @@ -152,6 +153,7 @@ initialRouteName, children, screenOptions, + screenListeners, }); // Clear ComposeSubchannel screens after each message is sent. If a user goes diff --git a/native/flow-typed/npm/@react-navigation/bottom-tabs_v5.x.x.js b/native/flow-typed/npm/@react-navigation/bottom-tabs_v5.x.x.js --- a/native/flow-typed/npm/@react-navigation/bottom-tabs_v5.x.x.js +++ b/native/flow-typed/npm/@react-navigation/bottom-tabs_v5.x.x.js @@ -837,15 +837,15 @@ & >( route: $If< $IsUndefined<$ElementType>, - | {| +key: string |} | - {| +name: DestinationRouteName, +key?: string |}, + | {| +key: string |} + | {| +name: DestinationRouteName, +key?: string |}, | {| +key: string, +params?: EitherExactOrPartialWithMergeProperty< $ElementType, >, - |} | - {| + |} + | {| +name: DestinationRouteName, +key?: string, +params?: EitherExactOrPartialWithMergeProperty< @@ -933,7 +933,7 @@ */ declare export type RouteProp< - ParamList: ParamListBase, + ParamList: ParamListBase = ParamListBase, RouteName: $Keys = $Keys, > = {| ...LeafRoute, @@ -1052,10 +1052,26 @@ EventMap, >) => React$Node; - declare type ScreenOptionsProp = {| + declare type ScreenOptionsProp< + ScreenOptions: {...}, + RouteParam, + NavHelpers, + > = {| +screenOptions?: | ScreenOptions - | ({| route: LeafRoute<>, navigation: NavHelpers |}) => ScreenOptions, + | ({| +route: RouteParam, +navigation: NavHelpers |}) => ScreenOptions, + |}; + declare type ScreenListenersProp< + ScreenListenersParam: {...}, + RouteParam, + NavHelpers, + > = {| + +screenListeners?: + | ScreenListenersParam + | ({| + +route: RouteParam, + +navigation: NavHelpers, + |}) => ScreenListenersParam, |}; declare export type ExtraNavigatorPropsBase = { ...$Exact, @@ -1063,11 +1079,29 @@ +children?: React$Node, ... }; - declare export type NavigatorPropsBase = { - ...$Exact, - ...ScreenOptionsProp, + declare export type NavigatorProps< + ScreenOptions: {...}, + ScreenListenersParam, + RouteParam, + NavHelpers, + ExtraNavigatorProps: ExtraNavigatorPropsBase, + > = { + ...$Exact, + ...ScreenOptionsProp, + ...ScreenListenersProp, ... }; + declare export type NavigatorPropsBase< + ScreenOptions: {...}, + ScreenListenersParam: {...}, + NavHelpers, + > = NavigatorProps< + ScreenOptions, + ScreenListenersParam, + RouteProp<>, + NavHelpers, + ExtraNavigatorPropsBase, + >; declare export type CreateNavigator< State: NavigationState, @@ -1090,18 +1124,15 @@ ScreenOptions, EventMap, >, - +Navigator: React$ComponentType<{| - ...$Exact, - ...ScreenOptionsProp, - +screenListeners?: - | ScreenListeners - | ({| - +route: RouteProp, - +navigation: NavHelpers, - |}) => ScreenListeners, - |}>, + +Navigator: React$ComponentType<$Exact, + RouteProp, + NavHelpers, + ExtraNavigatorProps, + >>>, +Group: React$ComponentType<{| - ...ScreenOptionsProp, + ...ScreenOptionsProp, NavHelpers>, +children: React$Node, +navigationKey?: string, |}>, @@ -1118,12 +1149,16 @@ >, ExtraNavigatorProps: ExtraNavigatorPropsBase, >( - navigator: React$ComponentType<{| - ...$Exact, - ...ScreenOptionsProp, - |}>, + navigator: React$ComponentType<$Exact, + RouteProp<>, + NavHelpers, + ExtraNavigatorProps, + >>>, ) => CreateNavigator; + /** * useNavigationBuilder */ @@ -1147,7 +1182,7 @@ routerFactory: RouterFactory, options: {| ...$Exact, - ...ScreenOptionsProp, + ...ScreenOptionsProp, NavHelpers>, +children?: React$Node, |}, ) => {| @@ -1428,10 +1463,13 @@ declare export type StackNavigatorProps< NavHelpers: StackNavigationHelpers<> = StackNavigationHelpers<>, - > = {| - ...ExtraStackNavigatorProps, - ...ScreenOptionsProp, - |}; + > = $Exact, + RouteProp<>, + NavHelpers, + ExtraStackNavigatorProps, + >>; /** * Bottom tab options @@ -1584,10 +1622,13 @@ declare export type BottomTabNavigatorProps< NavHelpers: BottomTabNavigationHelpers<> = BottomTabNavigationHelpers<>, - > = {| - ...ExtraBottomTabNavigatorProps, - ...ScreenOptionsProp, - |}; + > = $Exact, + RouteProp<>, + NavHelpers, + ExtraBottomTabNavigatorProps, + >>; /** * Material bottom tab options @@ -1736,10 +1777,13 @@ declare export type MaterialBottomTabNavigatorProps< NavHelpers: MaterialBottomTabNavigationHelpers<> = MaterialBottomTabNavigationHelpers<>, - > = {| - ...ExtraMaterialBottomTabNavigatorProps, - ...ScreenOptionsProp, - |}; + > = $Exact, + RouteProp<>, + NavHelpers, + ExtraMaterialBottomTabNavigatorProps, + >>; /** * Material top tab options @@ -1910,10 +1954,13 @@ declare export type MaterialTopTabNavigatorProps< NavHelpers: MaterialTopTabNavigationHelpers<> = MaterialTopTabNavigationHelpers<>, - > = {| - ...ExtraMaterialTopTabNavigatorProps, - ...ScreenOptionsProp, - |}; + > = $Exact, + RouteProp<>, + NavHelpers, + ExtraMaterialTopTabNavigatorProps, + >>; /** * Drawer options @@ -2044,10 +2091,13 @@ declare export type DrawerNavigatorProps< NavHelpers: DrawerNavigationHelpers<> = DrawerNavigationHelpers<>, - > = {| - ...ExtraDrawerNavigatorProps, - ...ScreenOptionsProp, - |}; + > = $Exact, + RouteProp<>, + NavHelpers, + ExtraDrawerNavigatorProps, + >>; /** * BaseNavigationContainer diff --git a/native/flow-typed/npm/@react-navigation/devtools_v5.x.x.js b/native/flow-typed/npm/@react-navigation/devtools_v5.x.x.js --- a/native/flow-typed/npm/@react-navigation/devtools_v5.x.x.js +++ b/native/flow-typed/npm/@react-navigation/devtools_v5.x.x.js @@ -837,15 +837,15 @@ & >( route: $If< $IsUndefined<$ElementType>, - | {| +key: string |} | - {| +name: DestinationRouteName, +key?: string |}, + | {| +key: string |} + | {| +name: DestinationRouteName, +key?: string |}, | {| +key: string, +params?: EitherExactOrPartialWithMergeProperty< $ElementType, >, - |} | - {| + |} + | {| +name: DestinationRouteName, +key?: string, +params?: EitherExactOrPartialWithMergeProperty< @@ -933,7 +933,7 @@ */ declare export type RouteProp< - ParamList: ParamListBase, + ParamList: ParamListBase = ParamListBase, RouteName: $Keys = $Keys, > = {| ...LeafRoute, @@ -1052,10 +1052,26 @@ EventMap, >) => React$Node; - declare type ScreenOptionsProp = {| + declare type ScreenOptionsProp< + ScreenOptions: {...}, + RouteParam, + NavHelpers, + > = {| +screenOptions?: | ScreenOptions - | ({| route: LeafRoute<>, navigation: NavHelpers |}) => ScreenOptions, + | ({| +route: RouteParam, +navigation: NavHelpers |}) => ScreenOptions, + |}; + declare type ScreenListenersProp< + ScreenListenersParam: {...}, + RouteParam, + NavHelpers, + > = {| + +screenListeners?: + | ScreenListenersParam + | ({| + +route: RouteParam, + +navigation: NavHelpers, + |}) => ScreenListenersParam, |}; declare export type ExtraNavigatorPropsBase = { ...$Exact, @@ -1063,11 +1079,29 @@ +children?: React$Node, ... }; - declare export type NavigatorPropsBase = { - ...$Exact, - ...ScreenOptionsProp, + declare export type NavigatorProps< + ScreenOptions: {...}, + ScreenListenersParam, + RouteParam, + NavHelpers, + ExtraNavigatorProps: ExtraNavigatorPropsBase, + > = { + ...$Exact, + ...ScreenOptionsProp, + ...ScreenListenersProp, ... }; + declare export type NavigatorPropsBase< + ScreenOptions: {...}, + ScreenListenersParam: {...}, + NavHelpers, + > = NavigatorProps< + ScreenOptions, + ScreenListenersParam, + RouteProp<>, + NavHelpers, + ExtraNavigatorPropsBase, + >; declare export type CreateNavigator< State: NavigationState, @@ -1090,18 +1124,15 @@ ScreenOptions, EventMap, >, - +Navigator: React$ComponentType<{| - ...$Exact, - ...ScreenOptionsProp, - +screenListeners?: - | ScreenListeners - | ({| - +route: RouteProp, - +navigation: NavHelpers, - |}) => ScreenListeners, - |}>, + +Navigator: React$ComponentType<$Exact, + RouteProp, + NavHelpers, + ExtraNavigatorProps, + >>>, +Group: React$ComponentType<{| - ...ScreenOptionsProp, + ...ScreenOptionsProp, NavHelpers>, +children: React$Node, +navigationKey?: string, |}>, @@ -1118,12 +1149,16 @@ >, ExtraNavigatorProps: ExtraNavigatorPropsBase, >( - navigator: React$ComponentType<{| - ...$Exact, - ...ScreenOptionsProp, - |}>, + navigator: React$ComponentType<$Exact, + RouteProp<>, + NavHelpers, + ExtraNavigatorProps, + >>>, ) => CreateNavigator; + /** * useNavigationBuilder */ @@ -1147,7 +1182,7 @@ routerFactory: RouterFactory, options: {| ...$Exact, - ...ScreenOptionsProp, + ...ScreenOptionsProp, NavHelpers>, +children?: React$Node, |}, ) => {| @@ -1428,10 +1463,13 @@ declare export type StackNavigatorProps< NavHelpers: StackNavigationHelpers<> = StackNavigationHelpers<>, - > = {| - ...ExtraStackNavigatorProps, - ...ScreenOptionsProp, - |}; + > = $Exact, + RouteProp<>, + NavHelpers, + ExtraStackNavigatorProps, + >>; /** * Bottom tab options @@ -1584,10 +1622,13 @@ declare export type BottomTabNavigatorProps< NavHelpers: BottomTabNavigationHelpers<> = BottomTabNavigationHelpers<>, - > = {| - ...ExtraBottomTabNavigatorProps, - ...ScreenOptionsProp, - |}; + > = $Exact, + RouteProp<>, + NavHelpers, + ExtraBottomTabNavigatorProps, + >>; /** * Material bottom tab options @@ -1736,10 +1777,13 @@ declare export type MaterialBottomTabNavigatorProps< NavHelpers: MaterialBottomTabNavigationHelpers<> = MaterialBottomTabNavigationHelpers<>, - > = {| - ...ExtraMaterialBottomTabNavigatorProps, - ...ScreenOptionsProp, - |}; + > = $Exact, + RouteProp<>, + NavHelpers, + ExtraMaterialBottomTabNavigatorProps, + >>; /** * Material top tab options @@ -1910,10 +1954,13 @@ declare export type MaterialTopTabNavigatorProps< NavHelpers: MaterialTopTabNavigationHelpers<> = MaterialTopTabNavigationHelpers<>, - > = {| - ...ExtraMaterialTopTabNavigatorProps, - ...ScreenOptionsProp, - |}; + > = $Exact, + RouteProp<>, + NavHelpers, + ExtraMaterialTopTabNavigatorProps, + >>; /** * Drawer options @@ -2044,10 +2091,13 @@ declare export type DrawerNavigatorProps< NavHelpers: DrawerNavigationHelpers<> = DrawerNavigationHelpers<>, - > = {| - ...ExtraDrawerNavigatorProps, - ...ScreenOptionsProp, - |}; + > = $Exact, + RouteProp<>, + NavHelpers, + ExtraDrawerNavigatorProps, + >>; /** * BaseNavigationContainer diff --git a/native/flow-typed/npm/@react-navigation/material-top-tabs_v5.x.x.js b/native/flow-typed/npm/@react-navigation/material-top-tabs_v5.x.x.js --- a/native/flow-typed/npm/@react-navigation/material-top-tabs_v5.x.x.js +++ b/native/flow-typed/npm/@react-navigation/material-top-tabs_v5.x.x.js @@ -837,15 +837,15 @@ & >( route: $If< $IsUndefined<$ElementType>, - | {| +key: string |} | - {| +name: DestinationRouteName, +key?: string |}, + | {| +key: string |} + | {| +name: DestinationRouteName, +key?: string |}, | {| +key: string, +params?: EitherExactOrPartialWithMergeProperty< $ElementType, >, - |} | - {| + |} + | {| +name: DestinationRouteName, +key?: string, +params?: EitherExactOrPartialWithMergeProperty< @@ -933,7 +933,7 @@ */ declare export type RouteProp< - ParamList: ParamListBase, + ParamList: ParamListBase = ParamListBase, RouteName: $Keys = $Keys, > = {| ...LeafRoute, @@ -1052,10 +1052,26 @@ EventMap, >) => React$Node; - declare type ScreenOptionsProp = {| + declare type ScreenOptionsProp< + ScreenOptions: {...}, + RouteParam, + NavHelpers, + > = {| +screenOptions?: | ScreenOptions - | ({| route: LeafRoute<>, navigation: NavHelpers |}) => ScreenOptions, + | ({| +route: RouteParam, +navigation: NavHelpers |}) => ScreenOptions, + |}; + declare type ScreenListenersProp< + ScreenListenersParam: {...}, + RouteParam, + NavHelpers, + > = {| + +screenListeners?: + | ScreenListenersParam + | ({| + +route: RouteParam, + +navigation: NavHelpers, + |}) => ScreenListenersParam, |}; declare export type ExtraNavigatorPropsBase = { ...$Exact, @@ -1063,11 +1079,29 @@ +children?: React$Node, ... }; - declare export type NavigatorPropsBase = { - ...$Exact, - ...ScreenOptionsProp, + declare export type NavigatorProps< + ScreenOptions: {...}, + ScreenListenersParam, + RouteParam, + NavHelpers, + ExtraNavigatorProps: ExtraNavigatorPropsBase, + > = { + ...$Exact, + ...ScreenOptionsProp, + ...ScreenListenersProp, ... }; + declare export type NavigatorPropsBase< + ScreenOptions: {...}, + ScreenListenersParam: {...}, + NavHelpers, + > = NavigatorProps< + ScreenOptions, + ScreenListenersParam, + RouteProp<>, + NavHelpers, + ExtraNavigatorPropsBase, + >; declare export type CreateNavigator< State: NavigationState, @@ -1090,18 +1124,15 @@ ScreenOptions, EventMap, >, - +Navigator: React$ComponentType<{| - ...$Exact, - ...ScreenOptionsProp, - +screenListeners?: - | ScreenListeners - | ({| - +route: RouteProp, - +navigation: NavHelpers, - |}) => ScreenListeners, - |}>, + +Navigator: React$ComponentType<$Exact, + RouteProp, + NavHelpers, + ExtraNavigatorProps, + >>>, +Group: React$ComponentType<{| - ...ScreenOptionsProp, + ...ScreenOptionsProp, NavHelpers>, +children: React$Node, +navigationKey?: string, |}>, @@ -1118,12 +1149,16 @@ >, ExtraNavigatorProps: ExtraNavigatorPropsBase, >( - navigator: React$ComponentType<{| - ...$Exact, - ...ScreenOptionsProp, - |}>, + navigator: React$ComponentType<$Exact, + RouteProp<>, + NavHelpers, + ExtraNavigatorProps, + >>>, ) => CreateNavigator; + /** * useNavigationBuilder */ @@ -1147,7 +1182,7 @@ routerFactory: RouterFactory, options: {| ...$Exact, - ...ScreenOptionsProp, + ...ScreenOptionsProp, NavHelpers>, +children?: React$Node, |}, ) => {| @@ -1428,10 +1463,13 @@ declare export type StackNavigatorProps< NavHelpers: StackNavigationHelpers<> = StackNavigationHelpers<>, - > = {| - ...ExtraStackNavigatorProps, - ...ScreenOptionsProp, - |}; + > = $Exact, + RouteProp<>, + NavHelpers, + ExtraStackNavigatorProps, + >>; /** * Bottom tab options @@ -1584,10 +1622,13 @@ declare export type BottomTabNavigatorProps< NavHelpers: BottomTabNavigationHelpers<> = BottomTabNavigationHelpers<>, - > = {| - ...ExtraBottomTabNavigatorProps, - ...ScreenOptionsProp, - |}; + > = $Exact, + RouteProp<>, + NavHelpers, + ExtraBottomTabNavigatorProps, + >>; /** * Material bottom tab options @@ -1736,10 +1777,13 @@ declare export type MaterialBottomTabNavigatorProps< NavHelpers: MaterialBottomTabNavigationHelpers<> = MaterialBottomTabNavigationHelpers<>, - > = {| - ...ExtraMaterialBottomTabNavigatorProps, - ...ScreenOptionsProp, - |}; + > = $Exact, + RouteProp<>, + NavHelpers, + ExtraMaterialBottomTabNavigatorProps, + >>; /** * Material top tab options @@ -1910,10 +1954,13 @@ declare export type MaterialTopTabNavigatorProps< NavHelpers: MaterialTopTabNavigationHelpers<> = MaterialTopTabNavigationHelpers<>, - > = {| - ...ExtraMaterialTopTabNavigatorProps, - ...ScreenOptionsProp, - |}; + > = $Exact, + RouteProp<>, + NavHelpers, + ExtraMaterialTopTabNavigatorProps, + >>; /** * Drawer options @@ -2044,10 +2091,13 @@ declare export type DrawerNavigatorProps< NavHelpers: DrawerNavigationHelpers<> = DrawerNavigationHelpers<>, - > = {| - ...ExtraDrawerNavigatorProps, - ...ScreenOptionsProp, - |}; + > = $Exact, + RouteProp<>, + NavHelpers, + ExtraDrawerNavigatorProps, + >>; /** * BaseNavigationContainer diff --git a/native/flow-typed/npm/@react-navigation/native_v5.x.x.js b/native/flow-typed/npm/@react-navigation/native_v5.x.x.js --- a/native/flow-typed/npm/@react-navigation/native_v5.x.x.js +++ b/native/flow-typed/npm/@react-navigation/native_v5.x.x.js @@ -837,15 +837,15 @@ & >( route: $If< $IsUndefined<$ElementType>, - | {| +key: string |} | - {| +name: DestinationRouteName, +key?: string |}, + | {| +key: string |} + | {| +name: DestinationRouteName, +key?: string |}, | {| +key: string, +params?: EitherExactOrPartialWithMergeProperty< $ElementType, >, - |} | - {| + |} + | {| +name: DestinationRouteName, +key?: string, +params?: EitherExactOrPartialWithMergeProperty< @@ -933,7 +933,7 @@ */ declare export type RouteProp< - ParamList: ParamListBase, + ParamList: ParamListBase = ParamListBase, RouteName: $Keys = $Keys, > = {| ...LeafRoute, @@ -1052,10 +1052,26 @@ EventMap, >) => React$Node; - declare type ScreenOptionsProp = {| + declare type ScreenOptionsProp< + ScreenOptions: {...}, + RouteParam, + NavHelpers, + > = {| +screenOptions?: | ScreenOptions - | ({| route: LeafRoute<>, navigation: NavHelpers |}) => ScreenOptions, + | ({| +route: RouteParam, +navigation: NavHelpers |}) => ScreenOptions, + |}; + declare type ScreenListenersProp< + ScreenListenersParam: {...}, + RouteParam, + NavHelpers, + > = {| + +screenListeners?: + | ScreenListenersParam + | ({| + +route: RouteParam, + +navigation: NavHelpers, + |}) => ScreenListenersParam, |}; declare export type ExtraNavigatorPropsBase = { ...$Exact, @@ -1063,11 +1079,29 @@ +children?: React$Node, ... }; - declare export type NavigatorPropsBase = { - ...$Exact, - ...ScreenOptionsProp, + declare export type NavigatorProps< + ScreenOptions: {...}, + ScreenListenersParam, + RouteParam, + NavHelpers, + ExtraNavigatorProps: ExtraNavigatorPropsBase, + > = { + ...$Exact, + ...ScreenOptionsProp, + ...ScreenListenersProp, ... }; + declare export type NavigatorPropsBase< + ScreenOptions: {...}, + ScreenListenersParam: {...}, + NavHelpers, + > = NavigatorProps< + ScreenOptions, + ScreenListenersParam, + RouteProp<>, + NavHelpers, + ExtraNavigatorPropsBase, + >; declare export type CreateNavigator< State: NavigationState, @@ -1090,18 +1124,15 @@ ScreenOptions, EventMap, >, - +Navigator: React$ComponentType<{| - ...$Exact, - ...ScreenOptionsProp, - +screenListeners?: - | ScreenListeners - | ({| - +route: RouteProp, - +navigation: NavHelpers, - |}) => ScreenListeners, - |}>, + +Navigator: React$ComponentType<$Exact, + RouteProp, + NavHelpers, + ExtraNavigatorProps, + >>>, +Group: React$ComponentType<{| - ...ScreenOptionsProp, + ...ScreenOptionsProp, NavHelpers>, +children: React$Node, +navigationKey?: string, |}>, @@ -1118,12 +1149,16 @@ >, ExtraNavigatorProps: ExtraNavigatorPropsBase, >( - navigator: React$ComponentType<{| - ...$Exact, - ...ScreenOptionsProp, - |}>, + navigator: React$ComponentType<$Exact, + RouteProp<>, + NavHelpers, + ExtraNavigatorProps, + >>>, ) => CreateNavigator; + /** * useNavigationBuilder */ @@ -1147,7 +1182,7 @@ routerFactory: RouterFactory, options: {| ...$Exact, - ...ScreenOptionsProp, + ...ScreenOptionsProp, NavHelpers>, +children?: React$Node, |}, ) => {| @@ -1428,10 +1463,13 @@ declare export type StackNavigatorProps< NavHelpers: StackNavigationHelpers<> = StackNavigationHelpers<>, - > = {| - ...ExtraStackNavigatorProps, - ...ScreenOptionsProp, - |}; + > = $Exact, + RouteProp<>, + NavHelpers, + ExtraStackNavigatorProps, + >>; /** * Bottom tab options @@ -1584,10 +1622,13 @@ declare export type BottomTabNavigatorProps< NavHelpers: BottomTabNavigationHelpers<> = BottomTabNavigationHelpers<>, - > = {| - ...ExtraBottomTabNavigatorProps, - ...ScreenOptionsProp, - |}; + > = $Exact, + RouteProp<>, + NavHelpers, + ExtraBottomTabNavigatorProps, + >>; /** * Material bottom tab options @@ -1736,10 +1777,13 @@ declare export type MaterialBottomTabNavigatorProps< NavHelpers: MaterialBottomTabNavigationHelpers<> = MaterialBottomTabNavigationHelpers<>, - > = {| - ...ExtraMaterialBottomTabNavigatorProps, - ...ScreenOptionsProp, - |}; + > = $Exact, + RouteProp<>, + NavHelpers, + ExtraMaterialBottomTabNavigatorProps, + >>; /** * Material top tab options @@ -1910,10 +1954,13 @@ declare export type MaterialTopTabNavigatorProps< NavHelpers: MaterialTopTabNavigationHelpers<> = MaterialTopTabNavigationHelpers<>, - > = {| - ...ExtraMaterialTopTabNavigatorProps, - ...ScreenOptionsProp, - |}; + > = $Exact, + RouteProp<>, + NavHelpers, + ExtraMaterialTopTabNavigatorProps, + >>; /** * Drawer options @@ -2044,10 +2091,13 @@ declare export type DrawerNavigatorProps< NavHelpers: DrawerNavigationHelpers<> = DrawerNavigationHelpers<>, - > = {| - ...ExtraDrawerNavigatorProps, - ...ScreenOptionsProp, - |}; + > = $Exact, + RouteProp<>, + NavHelpers, + ExtraDrawerNavigatorProps, + >>; /** * BaseNavigationContainer diff --git a/native/flow-typed/npm/@react-navigation/stack_v5.x.x.js b/native/flow-typed/npm/@react-navigation/stack_v5.x.x.js --- a/native/flow-typed/npm/@react-navigation/stack_v5.x.x.js +++ b/native/flow-typed/npm/@react-navigation/stack_v5.x.x.js @@ -837,15 +837,15 @@ & >( route: $If< $IsUndefined<$ElementType>, - | {| +key: string |} | - {| +name: DestinationRouteName, +key?: string |}, + | {| +key: string |} + | {| +name: DestinationRouteName, +key?: string |}, | {| +key: string, +params?: EitherExactOrPartialWithMergeProperty< $ElementType, >, - |} | - {| + |} + | {| +name: DestinationRouteName, +key?: string, +params?: EitherExactOrPartialWithMergeProperty< @@ -933,7 +933,7 @@ */ declare export type RouteProp< - ParamList: ParamListBase, + ParamList: ParamListBase = ParamListBase, RouteName: $Keys = $Keys, > = {| ...LeafRoute, @@ -1052,10 +1052,26 @@ EventMap, >) => React$Node; - declare type ScreenOptionsProp = {| + declare type ScreenOptionsProp< + ScreenOptions: {...}, + RouteParam, + NavHelpers, + > = {| +screenOptions?: | ScreenOptions - | ({| route: LeafRoute<>, navigation: NavHelpers |}) => ScreenOptions, + | ({| +route: RouteParam, +navigation: NavHelpers |}) => ScreenOptions, + |}; + declare type ScreenListenersProp< + ScreenListenersParam: {...}, + RouteParam, + NavHelpers, + > = {| + +screenListeners?: + | ScreenListenersParam + | ({| + +route: RouteParam, + +navigation: NavHelpers, + |}) => ScreenListenersParam, |}; declare export type ExtraNavigatorPropsBase = { ...$Exact, @@ -1063,11 +1079,29 @@ +children?: React$Node, ... }; - declare export type NavigatorPropsBase = { - ...$Exact, - ...ScreenOptionsProp, + declare export type NavigatorProps< + ScreenOptions: {...}, + ScreenListenersParam, + RouteParam, + NavHelpers, + ExtraNavigatorProps: ExtraNavigatorPropsBase, + > = { + ...$Exact, + ...ScreenOptionsProp, + ...ScreenListenersProp, ... }; + declare export type NavigatorPropsBase< + ScreenOptions: {...}, + ScreenListenersParam: {...}, + NavHelpers, + > = NavigatorProps< + ScreenOptions, + ScreenListenersParam, + RouteProp<>, + NavHelpers, + ExtraNavigatorPropsBase, + >; declare export type CreateNavigator< State: NavigationState, @@ -1090,18 +1124,15 @@ ScreenOptions, EventMap, >, - +Navigator: React$ComponentType<{| - ...$Exact, - ...ScreenOptionsProp, - +screenListeners?: - | ScreenListeners - | ({| - +route: RouteProp, - +navigation: NavHelpers, - |}) => ScreenListeners, - |}>, + +Navigator: React$ComponentType<$Exact, + RouteProp, + NavHelpers, + ExtraNavigatorProps, + >>>, +Group: React$ComponentType<{| - ...ScreenOptionsProp, + ...ScreenOptionsProp, NavHelpers>, +children: React$Node, +navigationKey?: string, |}>, @@ -1118,12 +1149,16 @@ >, ExtraNavigatorProps: ExtraNavigatorPropsBase, >( - navigator: React$ComponentType<{| - ...$Exact, - ...ScreenOptionsProp, - |}>, + navigator: React$ComponentType<$Exact, + RouteProp<>, + NavHelpers, + ExtraNavigatorProps, + >>>, ) => CreateNavigator; + /** * useNavigationBuilder */ @@ -1147,7 +1182,7 @@ routerFactory: RouterFactory, options: {| ...$Exact, - ...ScreenOptionsProp, + ...ScreenOptionsProp, NavHelpers>, +children?: React$Node, |}, ) => {| @@ -1428,10 +1463,13 @@ declare export type StackNavigatorProps< NavHelpers: StackNavigationHelpers<> = StackNavigationHelpers<>, - > = {| - ...ExtraStackNavigatorProps, - ...ScreenOptionsProp, - |}; + > = $Exact, + RouteProp<>, + NavHelpers, + ExtraStackNavigatorProps, + >>; /** * Bottom tab options @@ -1584,10 +1622,13 @@ declare export type BottomTabNavigatorProps< NavHelpers: BottomTabNavigationHelpers<> = BottomTabNavigationHelpers<>, - > = {| - ...ExtraBottomTabNavigatorProps, - ...ScreenOptionsProp, - |}; + > = $Exact, + RouteProp<>, + NavHelpers, + ExtraBottomTabNavigatorProps, + >>; /** * Material bottom tab options @@ -1736,10 +1777,13 @@ declare export type MaterialBottomTabNavigatorProps< NavHelpers: MaterialBottomTabNavigationHelpers<> = MaterialBottomTabNavigationHelpers<>, - > = {| - ...ExtraMaterialBottomTabNavigatorProps, - ...ScreenOptionsProp, - |}; + > = $Exact, + RouteProp<>, + NavHelpers, + ExtraMaterialBottomTabNavigatorProps, + >>; /** * Material top tab options @@ -1910,10 +1954,13 @@ declare export type MaterialTopTabNavigatorProps< NavHelpers: MaterialTopTabNavigationHelpers<> = MaterialTopTabNavigationHelpers<>, - > = {| - ...ExtraMaterialTopTabNavigatorProps, - ...ScreenOptionsProp, - |}; + > = $Exact, + RouteProp<>, + NavHelpers, + ExtraMaterialTopTabNavigatorProps, + >>; /** * Drawer options @@ -2044,10 +2091,13 @@ declare export type DrawerNavigatorProps< NavHelpers: DrawerNavigationHelpers<> = DrawerNavigationHelpers<>, - > = {| - ...ExtraDrawerNavigatorProps, - ...ScreenOptionsProp, - |}; + > = $Exact, + RouteProp<>, + NavHelpers, + ExtraDrawerNavigatorProps, + >>; /** * BaseNavigationContainer diff --git a/native/navigation/overlay-navigator.react.js b/native/navigation/overlay-navigator.react.js --- a/native/navigation/overlay-navigator.react.js +++ b/native/navigation/overlay-navigator.react.js @@ -8,6 +8,7 @@ StackNavigationProp, ParamListBase, StackNavigationHelpers, + ScreenListeners, } from '@react-navigation/native'; import { useNavigationBuilder, @@ -48,14 +49,21 @@ const { Value, timing, cond, call, lessOrEq, block } = Animated; /* eslint-enable import/no-named-as-default-member */ -type Props = $Exact>>; +type Props = $Exact< + NavigatorPropsBase< + {}, + ScreenListeners, + OverlayNavigationHelpers<>, + >, +>; const OverlayNavigator = React.memo( - ({ initialRouteName, children, screenOptions }: Props) => { + ({ initialRouteName, children, screenOptions, screenListeners }: Props) => { const { state, descriptors, navigation } = useNavigationBuilder( OverlayRouter, { children, screenOptions, + screenListeners, initialRouteName, }, ); diff --git a/native/navigation/root-navigator.react.js b/native/navigation/root-navigator.react.js --- a/native/navigation/root-navigator.react.js +++ b/native/navigation/root-navigator.react.js @@ -58,6 +58,7 @@ initialRouteName, children, screenOptions, + screenListeners, id, ...rest }: RootNavigatorProps) { @@ -66,6 +67,7 @@ initialRouteName, children, screenOptions, + screenListeners, }); const [keyboardHandlingEnabled, setKeyboardHandlingEnabled] = React.useState(