Skip to content
This repository was archived by the owner on Feb 25, 2020. It is now read-only.

Commit e22fa09

Browse files
committed
fix: fix types for stack config
1 parent 6f3ef1c commit e22fa09

File tree

3 files changed

+13
-8
lines changed

3 files changed

+13
-8
lines changed

src/navigators/createStackNavigator.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@ import { StackRouter, createNavigator } from '@react-navigation/core';
22
import { createKeyboardAwareNavigator } from '@react-navigation/native';
33
import { Platform } from 'react-native';
44
import StackView from '../views/Stack/StackView';
5-
import { NavigationStackOptions, NavigationProp, Screen } from '../types';
5+
import {
6+
NavigationStackConfig,
7+
NavigationStackOptions,
8+
NavigationProp,
9+
Screen,
10+
} from '../types';
611

712
function createStackNavigator(
813
routeConfigMap: {
@@ -17,7 +22,7 @@ function createStackNavigator(
1722
}) => NavigationStackOptions);
1823
};
1924
},
20-
stackConfig: NavigationStackOptions = {}
25+
stackConfig: NavigationStackConfig = {}
2126
) {
2227
const router = StackRouter(routeConfigMap, stackConfig);
2328

src/types.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,14 +107,14 @@ export type NavigationStackOptions = HeaderOptions &
107107
vertical?: number;
108108
horizontal?: number;
109109
};
110-
disableKeyboardHandling?: boolean;
111110
onTransitionStart?: () => void;
112111
onTransitionEnd?: () => void;
113112
};
114113

115-
export type NavigationConfig = {
116-
mode: 'card' | 'modal';
117-
headerMode: HeaderMode;
114+
export type NavigationStackConfig = {
115+
mode?: 'card' | 'modal';
116+
headerMode?: HeaderMode;
117+
disableKeyboardHandling?: boolean;
118118
};
119119

120120
export type SceneDescriptor = {

src/views/Stack/StackView.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ import HeaderContainer, {
77
} from '../Header/HeaderContainer';
88
import {
99
NavigationProp,
10-
NavigationConfig,
10+
NavigationStackConfig,
1111
Route,
1212
SceneDescriptorMap,
1313
} from '../../types';
1414

1515
type Props = {
1616
navigation: NavigationProp;
1717
descriptors: SceneDescriptorMap;
18-
navigationConfig: NavigationConfig;
18+
navigationConfig: NavigationStackConfig;
1919
onTransitionStart?: (
2020
current: { index: number },
2121
previous: { index: number }

0 commit comments

Comments
 (0)