Skip to content

Commit 1c75f17

Browse files
Ashoatbrentvatne
authored andcommitted
[flow] Fix TabBar types (react-navigation#5800)
1. `TabBarTop` is `MaterialTopTabBar` now 2. `MaterialTopTabBar` does not have a `getButtonComponent` prop (accidentally added in react-navigation#5648) 3. `BottomTabBar`'s `getButtonComponent` prop is a `React.Component`, not a `React.Node`
1 parent e542c84 commit 1c75f17

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

flow/react-navigation.js

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1184,7 +1184,7 @@ declare module 'react-navigation' {
11841184
};
11851185
declare export var TabView: React$ComponentType<_TabViewProps>;
11861186

1187-
declare type _TabBarTopProps = {
1187+
declare type _MaterialTopTabBarProps = {
11881188
activeTintColor: string,
11891189
inactiveTintColor: string,
11901190
showIcon: boolean,
@@ -1205,12 +1205,20 @@ declare module 'react-navigation' {
12051205
jumpToIndex: (index: number) => void,
12061206
}) => void,
12071207
renderIcon: (scene: TabScene) => React$Element<*>,
1208-
getButtonComponent: (scene: TabScene) => React$Element<*>,
12091208
labelStyle?: TextStyleProp,
12101209
iconStyle?: ViewStyleProp,
12111210
};
1212-
declare export var TabBarTop: React$ComponentType<_TabBarTopProps>;
1211+
declare export var MaterialTopTabBar: React$ComponentType<
1212+
_MaterialTopTabBarProps
1213+
>;
12131214

1215+
declare type _BottomTabBarButtonComponentProps = {
1216+
onPress: () => void,
1217+
onLongPress: () => void,
1218+
testID: string,
1219+
accessibilityLabel: string,
1220+
style: ViewStyleProp,
1221+
};
12141222
declare type _BottomTabBarProps = {
12151223
activeTintColor: string,
12161224
activeBackgroundColor: string,
@@ -1234,7 +1242,9 @@ declare module 'react-navigation' {
12341242
}) => void,
12351243
getTestIDProps: (scene: TabScene) => (scene: TabScene) => any,
12361244
renderIcon: (scene: TabScene) => React$Node,
1237-
getButtonComponent: (scene: TabScene) => React$Node,
1245+
getButtonComponent: (
1246+
scene: TabScene
1247+
) => React$ComponentType<_BottomTabBarButtonComponentProps>,
12381248
style?: ViewStyleProp,
12391249
animateStyle?: ViewStyleProp,
12401250
labelStyle?: TextStyleProp,

0 commit comments

Comments
 (0)