Giter Club home page Giter Club logo

react-native-lottie-tabbar's Introduction

`JSThread` to `JSThread`, `UIThread` to `UIThread`.

React Native Lottie Tabbar

A lottie animation tab bar written in react-native-reanimated v2.


Installation

First you have to follow installation instructions of react-native-reanimated v2 and react-native-lottie.

⚠️ Currently only supported react-navigation >=5.

npm install react-native-lottie-tabbar
or
yarn add react-native-lottie-tabbar

Usage

import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
import { NavigationContainer } from '@react-navigation/native';
import React, { useEffect, useState } from 'react';
import { View } from 'react-native';
import LottieTabbar, { TabItem } from 'react-native-lottie-tabbar';
const BottomTab = createBottomTabNavigator();

export enum RootScreenEnum {
  RootTab1 = 'home',
  RootTab2 = 'community',
  RootTab3 = 'cars',
  RootTab4 = 'notice',
}

const getViewStyle = (color: string) => ({
  flex: 1,
  backgroundColor: color,
});

const RootTab1 = () => {
  return <View style={getViewStyle(`rgba(61, 219, 209, 1)`)} />;
};
const RootTab2 = () => {
  return <View style={getViewStyle(`rgba(0, 99, 247, 1)`)} />;
};
const RootTab3 = () => {
  return <View style={getViewStyle(`rgba(255, 61, 74, 1)`)} />;
};
const RootTab4 = () => {
  return <View style={getViewStyle(`rgba(255, 187, 0, 1)`)} />;
};

const tabs: TabItem = {
  [RootScreenEnum.RootTab1]: {
    title: 'Home',
    lottieFile: require('./lottie/home.json'),
    iconSize: 24,
    textWidth: 30,
  },
  [RootScreenEnum.RootTab2]: {
    title: 'Community',
    lottieFile: require('./lottie/community.json'),
    iconSize: 24,
    textWidth: 60,
  },
  [RootScreenEnum.RootTab3]: {
    title: 'Cars',
    lottieFile: require('./lottie/car.json'),
    iconSize: 24,
    textWidth: 24,
  },
  [RootScreenEnum.RootTab4]: {
    title: 'Message',
    lottieFile: require('./lottie/notice.json'),
    iconSize: 24,
    textWidth: 46,
    isShowBadge: true,
    badgeCount: 1,
  },
};

const App = () => {
  return (
    <NavigationContainer>
      <BottomTab.Navigator
        initialRouteName={RootScreenEnum.RootTab1}
        tabBar={(props) => <LottieTabbar {...props} tabs={tabs} />}
        screenOptions={{
          headerShown: false,
        }}
      >
        <BottomTab.Screen name={RootScreenEnum.RootTab1} component={RootTab1} />
        <BottomTab.Screen name={RootScreenEnum.RootTab2} component={RootTab2} />
        <BottomTab.Screen name={RootScreenEnum.RootTab3} component={RootTab3} />
        <BottomTab.Screen name={RootScreenEnum.RootTab4} component={RootTab4} />
      </BottomTab.Navigator>
    </NavigationContainer>
  );
};

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT

react-native-lottie-tabbar's People

Contributors

alantoa avatar

Stargazers

Itzhak Ira avatar klosmo avatar  avatar lizihanglove avatar Bogdan Georgian Alexa avatar  avatar Akeman avatar Michael Allen avatar  avatar Roman avatar iReka Soft avatar Carlos Villarreal avatar luthink avatar Miguel avatar  avatar Ovidiu Cristescu avatar  avatar Meksi Abdennour avatar Tuan Nguyen avatar Robert Soriano avatar Michael Demarais avatar  avatar Govind Maheshwari avatar Rohit Ashok Khot avatar  avatar Enes KAPLAN avatar Ram Singh avatar Kasim avatar Temitope Adebayo avatar keep avatar Henrique Marques avatar Cem Turan avatar Oluwafemi avatar Hirbod avatar Brook avatar Anurag Alla avatar Manish Kumar Sahu avatar  avatar Andrew Margetts avatar  avatar Doddy Rizal Novianto avatar Furkan Türkyılmaz avatar afei avatar Ahmad Syarifuddin Randiko avatar Phi Thu avatar

Watchers

Michael Demarais avatar Michael Allen avatar Furkan Türkyılmaz avatar  avatar

react-native-lottie-tabbar's Issues

can't run for some native error

it's show error: com.facebook.react.bridge.JSApplicationIllegalArgumentException: Animated node with ID 2 already exists

react-native-reanimated is latest version 2.4.1


Another issue,animted-tab-bar-item.tsx first line path is error:
import { palette } from '../example/src/App';

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.