Skip to content

Commit ec97b61

Browse files
itsjgfbrentvatne
authored andcommitted
chore(typescript): export ScreenProps (react-navigation#5726)
1 parent b9f50bd commit ec97b61

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
77

88
## [Unreleased]
99

10-
- Export TabBarIconProps, TabBarLabelProps, DrawerIconProps and DrawerLabelProps.
10+
- Export TabBarIconProps, TabBarLabelProps, DrawerIconProps, DrawerLabelProps and ScreenProps.
1111

1212
## [3.5.1] - [2019-03-19](https://github.com/react-navigation/react-navigation/releases/tag/3.5.1)
1313

typescript/react-navigation.d.ts

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,14 @@ declare module 'react-navigation' {
6666

6767
export const HeaderStyleInterpolator: HeaderStyleInterpolatorStatic;
6868

69+
export type ScreenProps = {
70+
[key: string]: any;
71+
}
72+
6973
// @todo - any..
7074
export function getActiveChildNavigationOptions<S>(
7175
navigation: NavigationProp<S>,
72-
screenProps?: object
76+
screenProps?: ScreenProps
7377
): NavigationParams;
7478

7579
// @todo when we split types into common, native and web,
@@ -172,7 +176,7 @@ declare module 'react-navigation' {
172176

173177
export type NavigationScreenOptionsGetter<Options> = (
174178
navigation: NavigationScreenProp<NavigationRoute<any>>,
175-
screenProps?: { [key: string]: any }
179+
screenProps?: ScreenProps
176180
) => Options;
177181

178182
export interface NavigationRouter<State = NavigationState, Options = {}> {
@@ -233,7 +237,7 @@ declare module 'react-navigation' {
233237

234238
export interface NavigationScreenConfigProps {
235239
navigation: NavigationScreenProp<NavigationRoute>;
236-
screenProps: { [key: string]: any };
240+
screenProps: ScreenProps;
237241
}
238242

239243
export type NavigationScreenConfig<Options> =
@@ -732,7 +736,7 @@ declare module 'react-navigation' {
732736
export interface NavigationNavigatorProps<O = {}, S = {}> {
733737
detached?: boolean;
734738
navigation?: NavigationProp<S>;
735-
screenProps?: { [key: string]: any };
739+
screenProps?: ScreenProps;
736740
navigationOptions?: O;
737741
}
738742

@@ -787,7 +791,7 @@ declare module 'react-navigation' {
787791
scene: NavigationScene;
788792
index: number;
789793

790-
screenProps?: { [key: string]: any };
794+
screenProps?: ScreenProps;
791795
}
792796

793797
// The scene renderer props are nearly identical to the props used for rendering
@@ -885,7 +889,7 @@ declare module 'react-navigation' {
885889
navigation?: NavigationScreenProp<S>;
886890
persistenceKey?: string | null;
887891
renderLoadingExperimental?: React.ComponentType;
888-
screenProps?: any;
892+
screenProps?: ScreenProps;
889893
navigationOptions?: O;
890894
style?: StyleProp<ViewStyle>;
891895
}
@@ -907,7 +911,7 @@ declare module 'react-navigation' {
907911
): NavigationContainerComponent;
908912

909913
router: NavigationRouter<any, any>;
910-
screenProps: { [key: string]: any };
914+
screenProps: ScreenProps;
911915
navigationOptions: any;
912916
state: { nav: NavigationState | null };
913917
}
@@ -1280,7 +1284,7 @@ declare module 'react-navigation' {
12801284
{
12811285
descriptors: { [key: string]: NavigationDescriptor };
12821286
navigationConfig: O;
1283-
screenProps?: { [key: string]: any };
1287+
screenProps?: ScreenProps;
12841288
} & NavigationInjectedProps
12851289
>;
12861290

@@ -1325,7 +1329,7 @@ declare module 'react-navigation' {
13251329
Options = any
13261330
> {
13271331
navigation: NavigationScreenProp<NavigationRoute<Params>, Params>;
1328-
screenProps?: { [key: string]: any };
1332+
screenProps?: ScreenProps;
13291333
navigationOptions?: NavigationScreenConfig<Options>;
13301334
}
13311335

0 commit comments

Comments
 (0)