2.0.1 • Published 4 years ago

@deliriumproducts/react-native-animated-nav-tab-bar v2.0.1

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

npm version contributions welcome HitCount npm

react-native-animated-nav-tab-bar

A simple and customisable React Native component that implements an animated bottom tab bar for React Navigation.

  • Support for iPhoneX

Preview

Prerequisites

❗️In order to use the component, you need to have React Navigation installed

Installation

If using yarn

yarn add react-native-animated-nav-tab-bar

If using npm

npm install react-native-animated-nav-tab-bar

Usage

import { TabBar } from "react-native-animated-nav-tab-bar";

Simply place a <TabBar /> tag in the tabBar in the configuration option object of the navigation function

...

const Tabs = createBottomTabNavigator();

export default () => (
  <Tabs.Navigator
    tabBarOptions={{
      activeTintColor: "#2F7C6E",
      inactiveTintColor: "#222222"
    }}
    tabBar={props => (
      <TabBar
        activeColors={['#e6b580', '#8e87d6', '#c095c9']} // or activeColors={'#e6b580'}
        activeTabBackgrounds={['#ede7e6', '#eae3f6', '#eae4f6']} // or activeTabBackgrounds={'#ede7e6'}
        {...props}
      />
    )}
  >
  </Tabs.Navigator>

Add icons to your Bottom Navigation To use this, you need react-native-vector-icons

Example

import Icon from 'react-native-vector-icons/Feather';
...

export default () =>
  <Tabs.Navigator
    tabBarOptions={{
      activeTintColor: "#2F7C6E",
      inactiveTintColor: "#222222"
    }}
    tabBar={props => (
      <TabBar
        activeColors={"#2F7C6E"}
        activeTabBackgrounds={"#DFF7F6"}
        {...props}
      />
    )}
  >
    <Tabs.Screen
      name="Home"
      component={Home}
      options={{
        tabBarIcon: ({ focused, color, size }) => (
            <Icon
                name="Home"
                size={size ? size : 24}
                color={focused ? color : "#222222"}
                focused={focused}
                color={color}
            />
        )
      }}
    />
    </Tabs.Navigator>
...

Documentation

TabBar Component

NameDescriptionDefaultType
activeTabBackgroundColor of active tab backgorund#E4F7F7String
tabBarBackgroundBackgorund color for the wrapper that contains the navigation tabs#FFFFFFString
shadowIf set to true, the wrapper has a light shadowtrueBool
verticalPaddingVertical space between for the tab buttons10Number
topPaddingSpace between the tab button and the wrapper (top)10Number

Contributing

Pull requests are always welcome! Feel free to open a new GitHub issue for any changes that can be made.

Working on your first Pull Request? You can learn how from this free series How to Contribute to an Open Source Project on GitHub

Author

Catalin Torge @torgeadelin

License

MIT