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

Commit

Permalink
Rename shouldRenderLabelBeneathIcon to tabDirection
Browse files Browse the repository at this point in the history
  • Loading branch information
benoitdion committed Mar 15, 2019
1 parent 8d4bf58 commit a384867
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/views/BottomTabBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ export type TabBarOptions = {
showIcon: boolean,
labelStyle: any,
tabStyle: any,
tabDirection: any;
adaptive?: boolean,
style: any,
shouldRenderLabelBeneathIcon?: (options: { isLandscape: boolean }) => boolean;
};

type Props = TabBarOptions & {
Expand Down Expand Up @@ -170,10 +170,19 @@ class TabBarBottom extends React.Component<Props> {

_shouldUseHorizontalLabels = () => {
const { routes } = this.props.navigation.state;
const { isLandscape, dimensions, adaptive, tabStyle, shouldRenderLabelBeneathIcon } = this.props;
const { isLandscape, dimensions, adaptive, tabStyle, tabDirection } = this.props;

if (tabDirection) {
let direction;
if (typeof direction === 'string') {
direction = tabDirection;
} else {
direction = tabDirection({ deviceOrientation: isLandscape ? 'horizontal' : 'vertical' });
}

if (shouldRenderLabelBeneathIcon) {
return !shouldRenderLabelBeneathIcon({ isLandscape });
if (direction) {
return direction === 'row';
}
}

if (!adaptive) {
Expand Down

0 comments on commit a384867

Please sign in to comment.