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

Commit

Permalink
feat: export tab bars
Browse files Browse the repository at this point in the history
  • Loading branch information
satya164 committed Aug 18, 2019
1 parent d29e51d commit a4ead48
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 9 deletions.
13 changes: 13 additions & 0 deletions packages/bottom-tabs/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
/* eslint-disable import/no-commonjs */

module.exports = {
/**
* Navigators
*/
get createBottomTabNavigator() {
return require('./navigators/createBottomTabNavigator').default;
},
Expand All @@ -11,4 +14,14 @@ module.exports = {
get createMaterialBottomTabNavigator() {
return require('./navigators/createMaterialBottomTabNavigator').default;
},

/**
* Views
*/
get MaterialTopTabBar() {
return require('./views/MaterialTopTabBar').default;
},
get BottomTabBar() {
return require('./views/BottomTabBar').default;
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { View, StyleSheet } from 'react-native';
import createTabNavigator, {
type InjectedProps,
} from '../utils/createTabNavigator';
import TabBarBottom, { type TabBarOptions } from '../views/TabBarBottom';
import BottomTabBar, { type TabBarOptions } from '../views/BottomTabBar';

type Props = InjectedProps & {
tabBarComponent?: React.ComponentType<*>,
Expand Down Expand Up @@ -47,10 +47,9 @@ class TabNavigationView extends React.PureComponent<Props, State> {

_renderTabBar = () => {
const {
tabBarComponent: TabBarComponent = TabBarBottom,
tabBarComponent: TabBarComponent = BottomTabBar,
tabBarOptions,
navigation,
onIndexChange,
screenProps,
getLabelText,
renderIcon,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ import { TabViewAnimated, TabViewPagerPan } from 'react-native-tab-view';
import createTabNavigator, {
type InjectedProps,
} from '../utils/createTabNavigator';
import TabBarTop, { type TabBarOptions } from '../views/TabBarTop';
import MaterialTopTabBar, {
type TabBarOptions,
} from '../views/MaterialTopTabBar';

type Props = InjectedProps & {
animationEnabled?: boolean,
Expand Down Expand Up @@ -85,7 +87,7 @@ class TabView extends React.PureComponent<Props> {
options.tabBarVisible == null ? true : options.tabBarVisible;

const {
tabBarComponent: TabBarComponent = TabBarTop,
tabBarComponent: TabBarComponent = MaterialTopTabBar,
tabBarPosition,
tabBarOptions,
} = this.props;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
} from 'react-native';
import SafeAreaView from 'react-native-safe-area-view';

import TabBarIcon from './TabBarIcon';
import CrossFadeIcon from './CrossFadeIcon';
import withDimensions from '../utils/withDimensions';

export type TabBarOptions = {
Expand Down Expand Up @@ -119,7 +119,7 @@ class TabBarBottom extends React.Component<Props> {
const inactiveOpacity = focused ? 0 : 1;

return (
<TabBarIcon
<CrossFadeIcon
route={route}
navigation={navigation}
activeOpacity={activeOpacity}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import * as React from 'react';
import { Animated, StyleSheet } from 'react-native';
import { TabBar } from 'react-native-tab-view';
import TabBarIcon from './TabBarIcon';
import CrossFadeIcon from './CrossFadeIcon';

export type TabBarOptions = {
activeTintColor?: string,
Expand Down Expand Up @@ -116,7 +116,7 @@ export default class TabBarTop extends React.PureComponent<Props> {
});

return (
<TabBarIcon
<CrossFadeIcon
route={route}
navigation={navigation}
activeOpacity={activeOpacity}
Expand Down

0 comments on commit a4ead48

Please sign in to comment.