From 3bf46e1ad2fe4efdb0dbd47efe341d4466781a1b Mon Sep 17 00:00:00 2001 From: "satyajit.happy" Date: Tue, 22 Oct 2019 15:30:49 +0200 Subject: [PATCH] refactor: don't pass orientation to label --- packages/bottom-tabs/src/types.tsx | 7 +------ packages/bottom-tabs/src/views/BottomTabBar.tsx | 6 +----- packages/example/src/Screens/BottomTabs.tsx | 5 ++++- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/packages/bottom-tabs/src/types.tsx b/packages/bottom-tabs/src/types.tsx index df143c71..a777db45 100644 --- a/packages/bottom-tabs/src/types.tsx +++ b/packages/bottom-tabs/src/types.tsx @@ -71,11 +71,7 @@ export type BottomTabNavigationOptions = { */ tabBarLabel?: | React.ReactNode - | ((props: { - focused: boolean; - color: string; - size: number; - }) => React.ReactNode); + | ((props: { focused: boolean; color: string }) => React.ReactNode); /** * React Element or a function that given { focused: boolean, color: string } returns a React.Node, to display in the tab bar. @@ -221,7 +217,6 @@ export type BottomTabBarProps = BottomTabBarOptions & { | ((scene: { focused: boolean; color: string; - orientation: 'horizontal' | 'vertical'; }) => React.ReactNode | undefined) | React.ReactNode; getTestID: (props: { route: Route }) => string | undefined; diff --git a/packages/bottom-tabs/src/views/BottomTabBar.tsx b/packages/bottom-tabs/src/views/BottomTabBar.tsx index 713f0ff8..203898d0 100644 --- a/packages/bottom-tabs/src/views/BottomTabBar.tsx +++ b/packages/bottom-tabs/src/views/BottomTabBar.tsx @@ -157,11 +157,7 @@ export default class TabBarBottom extends React.Component { } if (typeof label === 'function') { - return label({ - focused, - color, - orientation: horizontal ? 'horizontal' : 'vertical', - }); + return label({ focused, color }); } return label; diff --git a/packages/example/src/Screens/BottomTabs.tsx b/packages/example/src/Screens/BottomTabs.tsx index fbb78f92..aaf64613 100644 --- a/packages/example/src/Screens/BottomTabs.tsx +++ b/packages/example/src/Screens/BottomTabs.tsx @@ -49,7 +49,10 @@ export default function BottomTabsScreen() { name="chat" component={Chat} options={{ - title: 'Chat', + tabBarLabel: props => { + console.log(props); + return null; + }, tabBarIcon: getTabBarIcon('message-reply'), tabBarButtonComponent: TouchableBounce, }}