Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions types/react-navigation/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,7 @@ export interface NavigationScreenDetails<T> {
navigation: NavigationScreenProp<NavigationRoute>;
}

export interface NavigationScreenOptions {
title?: string;
}
export type NavigationScreenOptions = NavigationStackScreenOptions & NavigationTabScreenOptions & NavigationDrawerScreenOptions;

export interface NavigationScreenConfigProps {
navigation: NavigationScreenProp<NavigationRoute>;
Expand Down Expand Up @@ -289,7 +287,8 @@ export interface NavigationStackViewConfig {
onTransitionEnd?: () => void;
}

export type NavigationStackScreenOptions = NavigationScreenOptions & {
export interface NavigationStackScreenOptions {
title?: string;
header?: (React.ReactElement<any> | ((headerProps: HeaderProps) => React.ReactElement<any>)) | null;
headerTransparent?: boolean;
headerTitle?: string | React.ReactElement<any>;
Expand All @@ -305,14 +304,14 @@ export type NavigationStackScreenOptions = NavigationScreenOptions & {
headerBackground?: React.ReactNode | React.ReactType;
gesturesEnabled?: boolean;
gestureResponseDistance?: { vertical?: number; horizontal?: number };
};
}

export interface NavigationStackRouterConfig {
headerTransitionPreset?: 'fade-in-place' | 'uikit';
initialRouteName?: string;
initialRouteParams?: NavigationParams;
paths?: NavigationPathsConfig;
navigationOptions?: NavigationScreenConfig<NavigationStackScreenOptions>;
navigationOptions?: NavigationScreenConfig<NavigationScreenOptions>;
}

export type NavigationStackAction =
Expand Down Expand Up @@ -352,7 +351,7 @@ export interface NavigationPathsConfig {
export interface NavigationTabRouterConfig {
initialRouteName?: string;
paths?: NavigationPathsConfig;
navigationOptions?: NavigationScreenConfig<NavigationTabScreenOptions>;
navigationOptions?: NavigationScreenConfig<NavigationScreenOptions>;
order?: string[]; // todo: type these as the real route names rather than 'string'

// Does the back button cause the router to switch to the initial tab
Expand All @@ -364,7 +363,8 @@ export interface TabScene {
index: number;
tintColor?: string;
}
export interface NavigationTabScreenOptions extends NavigationScreenOptions {
export interface NavigationTabScreenOptions {
title?: string;
tabBarIcon?:
React.ReactElement<any>
| ((options: { tintColor: (string | null), focused: boolean }) => (React.ReactElement<
Expand All @@ -384,7 +384,8 @@ export interface NavigationTabScreenOptions extends NavigationScreenOptions {
}) => void;
}

export interface NavigationDrawerScreenOptions extends NavigationScreenOptions {
export interface NavigationDrawerScreenOptions {
title?: string;
drawerIcon?:
React.ReactElement<any>
| ((options: { tintColor: (string | null), focused: boolean }) => (React.ReactElement<
Expand Down
5 changes: 4 additions & 1 deletion types/react-navigation/react-navigation-tests.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,10 @@ const tabNavigatorConfigWithNavigationOptions: TabNavigatorConfig = {
navigationOptions: {
tabBarOnPress: ({scene, jumpToIndex}) => {
jumpToIndex(scene.index);
}
},
headerStyle: {
backgroundColor: 'red',
},
},
};

Expand Down