Giter Club home page Giter Club logo

react-native-bubble-tabbar's Introduction

๐Ÿงผ react-native-bubble-tabbar

cover with mockup
npm version weekly downloads npm bundle size license
NPM

Bubble Tab Bar Component for React Native which supports React Navigation V5 and TypeScript

๐Ÿš€ Action

showcase about how it works

๐Ÿ“ฆ Installation

npm install react react-native styled-components
# Or using yarn
yarn add react react-native styled-components

First, you should install peerdependencies as the command above. You might already installed react and react-native. If you're using TypeScript, it is recommended to install the typings for the each package, too.

npm install react-native-bubble-tabbar
# Or using yarn
yarn add react-native-bubble-tabbar

Finally, install this module and you're ready to go! ๐ŸŽ‰

๐Ÿ‹ Usage

import {
  faHome,
  faHeart,
  faCommentAlt,
  faBars,
} from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-native-fontawesome';
import { BottomTabBarProps } from '@react-navigation/bottom-tabs';
import React from 'react';
import BubbleTabBar, {
  IBubbleTabConfig,
  IIconRenderer,
} from 'react-native-bubble-tabbar';

const tabs: IBubbleTabConfig[] = [
  {
    activeColor: '#cc0066',
    activeBackgroundColor: '#f76a8c',
    activeIcon: faHome,
  },
  {
    activeColor: '#ff6f5e',
    activeBackgroundColor: '#f8dc88',
    activeIcon: faHeart,
  },
  {
    activeColor: '#1eb2a6',
    activeBackgroundColor: '#ccf0e1',
    activeIcon: faCommentAlt,
  },
  {
    activeColor: '#4d80e4',
    activeBackgroundColor: '#9aceff',
    activeIcon: faBars,
    name: 'Last',
  },
];

const fontAwesomeIconRenderer = ({ icon, color }: IIconRenderer) =>
  <FontAwesomeIcon
    icon={icon}
    color={color}
    size={18}
  />;

const CustomTabBar: React.FC<BottomTabBarProps> = ({
  state, descriptors, navigation,
}) => {
  return (
    <BubbleTabBar
      state={state}
      descriptors={descriptors}
      navigation={navigation}
      tabs={tabs}
      iconRenderer={fontAwesomeIconRenderer}
    />
  );
};

const Tab = createBottomTabNavigator();

const MainNavigator: React.FC = () => {
  return (
    <Tab.Navigator
      tabBar={({ state, descriptors, navigation }) =>
        <CustomTabBar
          state={state}
          descriptors={descriptors}
          navigation={navigation}
        />
      }
    >
      <Tab.Screen name="One" component={ScreenOne} />
      <Tab.Screen name="Two" component={ScreenTwo} />
      <Tab.Screen name="Three" component={ScreenThree} />
      <Tab.Screen name="Four" component={ScreenFour} />
      <Tab.Screen
        name="ThisRouteDoesNotShowBecauseOnlyFourObjectsAreInTabs"
        component={ScreenHiddenFromTabBar}
      />
    </Tab.Navigator>
  );
};

โœ”๏ธ tabs Props

name

Override prop name on <Tab.Screen /> component

Type Required
string No

activeColor

Color for active tab text and icon

Type Required
string Yes

activeBackgroundColor

BackgroundColor for active tab

Type Required
string Yes

inactiveColor

Color & background color for inactive tab

Type Required
string No

activeIcon

Icon name for active tab

Type Required
string No

disabledIcon

Icon name for inactive tab

Type Required
string No

โœ”๏ธ iconRenderer Props

Function with params

icon

Icon name to pass on Icon Component


color

Icon color to pass on Icon Component

react-native-bubble-tabbar's People

Contributors

abathz avatar abifdhllh avatar dependabot[bot] avatar imgbot[bot] avatar junhoyeo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

react-native-bubble-tabbar's Issues

[Bug] White divider in dark mode

Hello,

Firstly, gg for your component it work like a charm but I have a little problem with my dark mode . I have a white line screen showed and when I run your exemple I have the same issue. it's possible to remove this little padding ? :)

Thank

image

Unable to resolve module `styled-components/native`

Unable to resolve module styled-components/native from node_modules/react-native-bubble-tabbar/lib/BubbleTabBar.js: styled-components/native could not be found within the project.

If you are sure the module exists, try these steps:

  1. Clear watchman watches: watchman watch-del-all
  2. Delete node_modules: rm -rf node_modules and run yarn install
  3. Reset Metro's cache: yarn start --reset-cache
  4. Remove the cache: rm -rf /tmp/metro-*

[v0.0.10] cannot import module

i just update version of react-native-bubble-tabbar from 0.0.9 to 0.0.10. I got error message like this:

error: Error: While trying to resolve module react-native-bubble-tabbar from file /Users/adlifariz/Dev/komodo-mobile/packages/komodobuyer/src/routes/Home.navigator.tsx, the package /Users/adlifariz/Dev/komodo-mobile/node_modules/react-native-bubble-tabbar/package.json was successfully found. However, this package itself specifies a main module field that could not be resolved (/Users/adlifariz/Dev/komodo-mobile/node_modules/react-native-bubble-tabbar/lib/index.js.

I hope this bug can be solve in next version thank you ๐Ÿ™๐Ÿป

[Feature request] add ui kitten eva-icons support

Hi, I'm using the ui-kitten icons.

const evaIconRenderer = ({icon}: IIconRenderer) => <Icon name={icon} />;

const CustomTabBar: React.FC<BottomTabBarProps> = ({
  state,
  descriptors,
  navigation,
}) => {
  return (
    <BubbleTabBar
      state={state}
      descriptors={descriptors}
      navigation={navigation}
      tabs={tabs}
      iconRenderer={evaIconRenderer}
    />
  );
};

Even with the iconRenderer, I cannot get the icons show up.

Possibly this is due to the fact that eva icon is rendering icons with JSX elements.

The active highlight becomes eerily big.
Screenshot 2020-07-19 at 12 06 10 AM

Add proper documentation

I'm a little busy for a week of more, so if anyone wants to contribute, feel free to take this ๐Ÿ™Œ

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.