Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -190,16 +190,16 @@ declare module 'react-navigation' { | |
navigationOptions?: NavigationScreenConfig<Options, NavigationScreenPropType>; | ||
}; | ||
|
||
export interface NavigationScreenConfigProps<NavigationScreenPropType> { | ||
export interface NavigationScreenConfigProps<NavigationScreenPropType, ScreenProps = unknown> { | ||
navigation: NavigationScreenPropType; | ||
screenProps: unknown; | ||
screenProps: ScreenProps; | ||
theme: SupportedThemes; | ||
} | ||
|
||
export type NavigationScreenConfig<Options, NavigationScreenPropType> = | ||
export type NavigationScreenConfig<Options, NavigationScreenPropType, ScreenProps = unknown> = | ||
| Options | ||
| (( | ||
navigationOptionsContainer: NavigationScreenConfigProps<NavigationScreenPropType> & { | ||
navigationOptionsContainer: NavigationScreenConfigProps<NavigationScreenPropType, ScreenProps> & { | ||
navigationOptions: Options; | ||
} | ||
) => Options); | ||
|
@@ -542,20 +542,20 @@ declare module 'react-navigation' { | |
dangerouslyGetParent: () => NavigationScreenProp<S> | undefined; | ||
} | ||
|
||
export interface NavigationNavigatorProps<O = {}, S = {}> { | ||
export interface NavigationNavigatorProps<Options = {}, State = {}, ScreenProps = unknown> { | ||
theme?: SupportedThemes | 'no-preference'; | ||
detached?: boolean; | ||
navigation?: NavigationProp<S>; | ||
screenProps?: unknown; | ||
navigationOptions?: O; | ||
navigation?: NavigationProp<State>; | ||
screenProps?: ScreenProps; | ||
navigationOptions?: Options; | ||
} | ||
|
||
export type NavigatorType = | ||
| 'react-navigation/STACK' | ||
| 'react-navigation/TABS' | ||
| 'react-navigation/DRAWER'; | ||
|
||
export interface NavigationContainerProps<S = {}, O = {}> { | ||
export interface NavigationContainerProps<State = {}, Options = {}, ScreenProps = unknown> { | ||
uriPrefix?: string | RegExp; | ||
/** | ||
* Controls whether the navigation container handles URLs opened via 'Linking' | ||
|
@@ -568,7 +568,7 @@ declare module 'react-navigation' { | |
nextNavigationState: NavigationState, | ||
action: NavigationAction | ||
) => void | null | undefined; | ||
navigation?: NavigationScreenProp<S>; | ||
navigation?: NavigationScreenProp<State>; | ||
/* | ||
* This prop is no longer supported. Use `loadNavigationState` and | ||
* `persistNavigationState` instead. | ||
|
@@ -579,8 +579,8 @@ declare module 'react-navigation' { | |
persistNavigationState?: (state: NavigationState) => Promise<any>; | ||
|
||
renderLoadingExperimental?: React.ComponentType; | ||
screenProps?: unknown; | ||
navigationOptions?: O; | ||
screenProps?: ScreenProps; | ||
navigationOptions?: Options; | ||
style?: StyleProp<ViewStyle>; | ||
} | ||
|
||
|
@@ -613,9 +613,6 @@ declare module 'react-navigation' { | |
backBehavior?: 'none' | 'initialRoute'; | ||
} | ||
|
||
// Return createNavigationContainer | ||
export type _SwitchNavigatorConfig = NavigationSwitchRouterConfig; | ||
|
||
export function createSwitchNavigator( | ||
routeConfigMap: NavigationRouteConfigMap<SwitchNavigatorConfig, NavigationScreenProp<NavigationRoute>>, | ||
switchConfig?: SwitchNavigatorConfig | ||
|
@@ -738,11 +735,11 @@ declare module 'react-navigation' { | |
getComponent: () => React.ComponentType; | ||
} | ||
|
||
export type NavigationView<O, S> = React.ComponentType< | ||
export type NavigationView<Options, State, ScreenProps = unknown> = React.ComponentType< | ||
{ | ||
descriptors: { [key: string]: NavigationDescriptor }; | ||
navigationConfig: O; | ||
screenProps?: unknown; | ||
navigationConfig: Options; | ||
screenProps?: ScreenProps; | ||
} & NavigationInjectedProps | ||
>; | ||
|
||
|
@@ -779,28 +776,6 @@ declare module 'react-navigation' { | |
Component: NavigationNavigator<Options, NavigationPropType> | ||
): NavigationContainer; | ||
|
||
/** | ||
* END MANUAL DEFINITIONS OUTSIDE OF TYPEDEFINITION.JS | ||
*/ | ||
|
||
/** | ||
* BEGIN CUSTOM CONVENIENCE INTERFACES | ||
*/ | ||
|
||
export interface NavigationScreenProps< | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
mikehardy
Contributor
|
||
Params = NavigationParams, | ||
Options = {}, | ||
NavigationScreenPropType = NavigationScreenProp<NavigationRoute> | ||
> { | ||
navigation: NavigationScreenProp<NavigationRoute<Params>, Params>; | ||
screenProps?: unknown; | ||
navigationOptions?: NavigationScreenConfig<Options, NavigationScreenPropType>; | ||
} | ||
|
||
/** | ||
* END CUSTOM CONVENIENCE INTERFACES | ||
*/ | ||
|
||
export type Omit<T, K extends keyof any> = Pick<T, Exclude<keyof T, K>>; | ||
|
||
export type InferProps< | ||
|
This was a breaking change for me, and I'm not sure what types to migrate too, there was no guidance in the release notes or breaking change notice