From ec97b610c524db4402c406d401c99053532b7564 Mon Sep 17 00:00:00 2001 From: Jose G Date: Fri, 22 Mar 2019 19:11:05 +0100 Subject: [PATCH] chore(typescript): export ScreenProps (#5726) --- CHANGELOG.md | 2 +- typescript/react-navigation.d.ts | 22 +++++++++++++--------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 64cbb6e717..7ac4b15a98 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] -- Export TabBarIconProps, TabBarLabelProps, DrawerIconProps and DrawerLabelProps. +- Export TabBarIconProps, TabBarLabelProps, DrawerIconProps, DrawerLabelProps and ScreenProps. ## [3.5.1] - [2019-03-19](https://github.com/react-navigation/react-navigation/releases/tag/3.5.1) diff --git a/typescript/react-navigation.d.ts b/typescript/react-navigation.d.ts index 41f6e98e0b..a91d17050a 100644 --- a/typescript/react-navigation.d.ts +++ b/typescript/react-navigation.d.ts @@ -66,10 +66,14 @@ declare module 'react-navigation' { export const HeaderStyleInterpolator: HeaderStyleInterpolatorStatic; + export type ScreenProps = { + [key: string]: any; + } + // @todo - any.. export function getActiveChildNavigationOptions( navigation: NavigationProp, - screenProps?: object + screenProps?: ScreenProps ): NavigationParams; // @todo when we split types into common, native and web, @@ -172,7 +176,7 @@ declare module 'react-navigation' { export type NavigationScreenOptionsGetter = ( navigation: NavigationScreenProp>, - screenProps?: { [key: string]: any } + screenProps?: ScreenProps ) => Options; export interface NavigationRouter { @@ -233,7 +237,7 @@ declare module 'react-navigation' { export interface NavigationScreenConfigProps { navigation: NavigationScreenProp; - screenProps: { [key: string]: any }; + screenProps: ScreenProps; } export type NavigationScreenConfig = @@ -732,7 +736,7 @@ declare module 'react-navigation' { export interface NavigationNavigatorProps { detached?: boolean; navigation?: NavigationProp; - screenProps?: { [key: string]: any }; + screenProps?: ScreenProps; navigationOptions?: O; } @@ -787,7 +791,7 @@ declare module 'react-navigation' { scene: NavigationScene; index: number; - screenProps?: { [key: string]: any }; + screenProps?: ScreenProps; } // The scene renderer props are nearly identical to the props used for rendering @@ -885,7 +889,7 @@ declare module 'react-navigation' { navigation?: NavigationScreenProp; persistenceKey?: string | null; renderLoadingExperimental?: React.ComponentType; - screenProps?: any; + screenProps?: ScreenProps; navigationOptions?: O; style?: StyleProp; } @@ -907,7 +911,7 @@ declare module 'react-navigation' { ): NavigationContainerComponent; router: NavigationRouter; - screenProps: { [key: string]: any }; + screenProps: ScreenProps; navigationOptions: any; state: { nav: NavigationState | null }; } @@ -1280,7 +1284,7 @@ declare module 'react-navigation' { { descriptors: { [key: string]: NavigationDescriptor }; navigationConfig: O; - screenProps?: { [key: string]: any }; + screenProps?: ScreenProps; } & NavigationInjectedProps >; @@ -1325,7 +1329,7 @@ declare module 'react-navigation' { Options = any > { navigation: NavigationScreenProp, Params>; - screenProps?: { [key: string]: any }; + screenProps?: ScreenProps; navigationOptions?: NavigationScreenConfig; }