From d7677fb9fe74b138de2a4b8c05fef39d7c160fb2 Mon Sep 17 00:00:00 2001 From: Ashoat Tevosyan Date: Wed, 10 Apr 2019 12:35:52 -0400 Subject: [PATCH] [flow] Fix TabBar types (#5800) 1. `TabBarTop` is `MaterialTopTabBar` now 2. `MaterialTopTabBar` does not have a `getButtonComponent` prop (accidentally added in #5648) 3. `BottomTabBar`'s `getButtonComponent` prop is a `React.Component`, not a `React.Node` --- .../react-navigation/flow/react-navigation.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/packages/react-navigation/flow/react-navigation.js b/packages/react-navigation/flow/react-navigation.js index de7c89e2..08f46ea8 100644 --- a/packages/react-navigation/flow/react-navigation.js +++ b/packages/react-navigation/flow/react-navigation.js @@ -1184,7 +1184,7 @@ declare module 'react-navigation' { }; declare export var TabView: React$ComponentType<_TabViewProps>; - declare type _TabBarTopProps = { + declare type _MaterialTopTabBarProps = { activeTintColor: string, inactiveTintColor: string, showIcon: boolean, @@ -1205,12 +1205,20 @@ declare module 'react-navigation' { jumpToIndex: (index: number) => void, }) => void, renderIcon: (scene: TabScene) => React$Element<*>, - getButtonComponent: (scene: TabScene) => React$Element<*>, labelStyle?: TextStyleProp, iconStyle?: ViewStyleProp, }; - declare export var TabBarTop: React$ComponentType<_TabBarTopProps>; + declare export var MaterialTopTabBar: React$ComponentType< + _MaterialTopTabBarProps + >; + declare type _BottomTabBarButtonComponentProps = { + onPress: () => void, + onLongPress: () => void, + testID: string, + accessibilityLabel: string, + style: ViewStyleProp, + }; declare type _BottomTabBarProps = { activeTintColor: string, activeBackgroundColor: string, @@ -1234,7 +1242,9 @@ declare module 'react-navigation' { }) => void, getTestIDProps: (scene: TabScene) => (scene: TabScene) => any, renderIcon: (scene: TabScene) => React$Node, - getButtonComponent: (scene: TabScene) => React$Node, + getButtonComponent: ( + scene: TabScene + ) => React$ComponentType<_BottomTabBarButtonComponentProps>, style?: ViewStyleProp, animateStyle?: ViewStyleProp, labelStyle?: TextStyleProp,