2.0.5 • Published 2 years ago

curved-bottom-navigation-bar v2.0.5

Weekly downloads
56
License
MIT
Repository
github
Last release
2 years ago

High performance animated bottom navigation bar for both Android and IOS 😎 with react navigation v5 or higher.


Table of Contents

Installation

yarn add curved-bottom-navigation-bar
# or
npm install curved-bottom-navigation-bar

Also, you need to install react-native-reanimated-v2 & react-native-svg, and follow theirs installation instructions.

Usage

import React from 'react';
import { NavigationContainer } from '@react-navigation/native';
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
import AnimatedTabBar, {TabsConfigsType} from 'curved-bottom-navigation-bar';
import {SafeAreaProvider} from 'react-native-safe-area-context';
const tabs: TabsConfigsType = {
    Home: {
        icon: ({ progress, focused }) => /* Icon Component */,
        renderTitle: ({ progress, title }) => /* Custom reanimated Component */
    },
    Profile: {
        icon: ({ progress, focused }) => /* Icon Component */,
        renderTitle: ({ progress, title }) => /* Custom reanimated Component */
    },
}

const Tab = createBottomTabNavigator();

export default function App() {
  return (
  <SafeAreaProvider>
    <NavigationContainer>
      <Tab.Navigator
        tabBar={props => (
          <AnimatedTabBar tabs={tabs} {...props} />
        )}
      >
        <Tab.Screen
          name="Home"
          component={HomeScreen}
        />
        <Tab.Screen
          name="Profile"
          component={ProfileScreen}
        />
      </Tab.Navigator>
    </NavigationContainer>
  </SafeAreaProvider>
  )
}

Animated Icon

In order to animate the tab icon color, you will need to use the provded prop color that will be provided to the icon.

This example below should explain it better:

import React from 'react';
import Animated from 'react-native-reanimated';


interface AnimatedIconProps {
  progress: Animated.SharedValue<number>; // Reanimated - 0 is not Active, 1 is Active
  focused: boolean;
}

const AnimatedIcon = ({ progress }: AnimatedIconProps) => {
  return (
   /* DO SOME THING */
  );
};

export default AnimatedIcon;

Animated Title

Custom title value for tabbar

This example below should explain it better:

import React from 'react';
import Animated from 'react-native-reanimated';


interface AnimatedTitleProps {
  progress: Animated.SharedValue<number>; // Reanimated - 0 is not Active, 1 is Active
  title:string;
}

const AnimatedTitle = ({ progress, title }: AnimatedTitleProps) => {
  return (
   /* DO SOME THING */
  );
};

export default AnimatedTitle;

Props

namerequireddefaultdescription
durationNO500Duration for the tabs animation.
barColorNO#FFFFFFbackground color of bottom bar.
tabsYESA dictionary for all tabs configurations, check TabConfigsType interface.
dotSizeNO60Size of dot.
dotColorNO#FFFFFFColor of dot.
titleShownNOfalseWhether to show or hide the title for the bottom bar

TabConfigsType

namerequireddefaultdescription
iconYESComponent to be render as tab icon, it will recevie an animated node prop progress.
renderTitleNOComponent to be render as tab title, it will recevie an animated node prop progress and title.

Built With

License

MIT


2.0.5

2 years ago

2.0.3

2 years ago

2.0.4

2 years ago

2.0.2

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.11

3 years ago

1.0.10

3 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago

0.8.0

4 years ago

0.7.0

4 years ago

0.6.0

4 years ago

0.5.0

4 years ago

0.3.0

4 years ago

0.2.0

4 years ago

0.4.0

4 years ago

0.1.0

4 years ago