Skip to content

Commit

Permalink
chore(typescript): export ScreenProps (react-navigation#5726)
Browse files Browse the repository at this point in the history
  • Loading branch information
itsjgf authored and brentvatne committed Mar 22, 2019
1 parent b9f50bd commit ec97b61
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
22 changes: 13 additions & 9 deletions typescript/react-navigation.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,14 @@ declare module 'react-navigation' {

export const HeaderStyleInterpolator: HeaderStyleInterpolatorStatic;

export type ScreenProps = {
[key: string]: any;
}

// @todo - any..
export function getActiveChildNavigationOptions<S>(
navigation: NavigationProp<S>,
screenProps?: object
screenProps?: ScreenProps
): NavigationParams;

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

export type NavigationScreenOptionsGetter<Options> = (
navigation: NavigationScreenProp<NavigationRoute<any>>,
screenProps?: { [key: string]: any }
screenProps?: ScreenProps
) => Options;

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

export interface NavigationScreenConfigProps {
navigation: NavigationScreenProp<NavigationRoute>;
screenProps: { [key: string]: any };
screenProps: ScreenProps;
}

export type NavigationScreenConfig<Options> =
Expand Down Expand Up @@ -732,7 +736,7 @@ declare module 'react-navigation' {
export interface NavigationNavigatorProps<O = {}, S = {}> {
detached?: boolean;
navigation?: NavigationProp<S>;
screenProps?: { [key: string]: any };
screenProps?: ScreenProps;
navigationOptions?: O;
}

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -885,7 +889,7 @@ declare module 'react-navigation' {
navigation?: NavigationScreenProp<S>;
persistenceKey?: string | null;
renderLoadingExperimental?: React.ComponentType;
screenProps?: any;
screenProps?: ScreenProps;
navigationOptions?: O;
style?: StyleProp<ViewStyle>;
}
Expand All @@ -907,7 +911,7 @@ declare module 'react-navigation' {
): NavigationContainerComponent;

router: NavigationRouter<any, any>;
screenProps: { [key: string]: any };
screenProps: ScreenProps;
navigationOptions: any;
state: { nav: NavigationState | null };
}
Expand Down Expand Up @@ -1280,7 +1284,7 @@ declare module 'react-navigation' {
{
descriptors: { [key: string]: NavigationDescriptor };
navigationConfig: O;
screenProps?: { [key: string]: any };
screenProps?: ScreenProps;
} & NavigationInjectedProps
>;

Expand Down Expand Up @@ -1325,7 +1329,7 @@ declare module 'react-navigation' {
Options = any
> {
navigation: NavigationScreenProp<NavigationRoute<Params>, Params>;
screenProps?: { [key: string]: any };
screenProps?: ScreenProps;
navigationOptions?: NavigationScreenConfig<Options>;
}

Expand Down

0 comments on commit ec97b61

Please sign in to comment.