💅🔧👌 a beautiful, customizable and easy-to-use material design bottom navigation for react-native
Clone or download
davidmpr and timomeh Added new iPhone XR/XS Max screen width and height (#110)
* Added new 2018 iPhone sizes to compute SafeArea

* Removed semicolons to match project style
Latest commit d9c636f Oct 8, 2018
Permalink
Failed to load latest commit information.
.circleci Add circleci config Mar 26, 2018
.github Update ISSUE_TEMPLATE.md May 15, 2018
__tests__ Rename test files with test suffix Mar 27, 2018
docs Fix wrong documentation of onTabPress parameters May 30, 2018
examples/Playground Fix wrong documentation of onTabPress parameters May 30, 2018
flow-typed Add comment Mar 25, 2018
lib Added new iPhone XR/XS Max screen width and height (#110) Oct 8, 2018
scripts Add gitbook Mar 27, 2018
.babelrc Complete refactor. Everything new. Everything Feb 23, 2017
.editorconfig Complete refactor. Everything new. Everything Feb 23, 2017
.eslintignore Add copied utils file to eslintignore Sep 18, 2018
.eslintrc.json Add linting with eslint and prettier Feb 24, 2018
.gitbook.yml Update to new gitbook May 14, 2018
.gitignore Add gitbook Mar 27, 2018
.npmrc Remove package-lock, which is not needed for libs Sep 18, 2018
.nvmrc Add nvmrc Sep 18, 2018
.prettierrc.json Add linting with eslint and prettier Feb 24, 2018
CODE_OF_CONDUCT.md Revert "GitBook: [master] 7 pages and 8 assets modified" May 14, 2018
CONTRIBUTING.md Add Contributing informations May 14, 2018
LICENSE Update LICENSE Feb 27, 2018
README.md Fix wrong documentation of onTabPress parameters May 30, 2018
index.d.ts Adapt typescript config Mar 23, 2018
index.js Add Badge Component Mar 22, 2018
package.json Fix (hopefully) failing tests caused by JSDOM update Sep 18, 2018
setupTests.js Add working test & playground setup Mar 25, 2018

README.md

react-native-material-bottom-navigation


npm version downloads

A beautiful, customizable and easy-to-use
Material Design Bottom Navigation for react-native.


  • Pure JavaScript. No native dependencies. No linking. No obstacles.
  • Looks beautiful. Stunning and fluid animations. You won't believe it's not a native view.
  • Customize it. You can adjust nearly everything to make it fit perfectly to your app.
  • Easy to use. Uses established React patterns for both simple and advanced usage.
  • Pluggable. Includes customizable Tabs and Badges. Not enough? Create and use your own!

Installation

Using npm:

npm install react-native-material-bottom-navigation

Or using yarn:

yarn add react-native-material-bottom-navigation

Table of Contents

Demo


Shifting Tab


Full Tab


Icon Tab

Usage

This library uses "render props" as established pattern for component composition. The example below illustrates the basic usage of the Bottom Navigation. All available Props are listed in the Documentation.

Dive into the example below, check out the example app and take a look at the Usage Documentation.

import BottomNavigation, {
  FullTab
} from 'react-native-material-bottom-navigation'

export default class App extends React.Component {
  tabs = [
    {
      key: 'games',
      icon: 'gamepad-variant',
      label: 'Games',
      barColor: '#388E3C',
      pressColor: 'rgba(255, 255, 255, 0.16)'
    },
    {
      key: 'movies-tv',
      icon: 'movie',
      label: 'Movies & TV',
      barColor: '#B71C1C',
      pressColor: 'rgba(255, 255, 255, 0.16)'
    },
    {
      key: 'music',
      icon: 'music-note',
      label: 'Music',
      barColor: '#E64A19',
      pressColor: 'rgba(255, 255, 255, 0.16)'
    }
  ]

  renderIcon = icon => ({ isActive }) => (
    <Icon size={24} color="white" name={icon} />
  )

  renderTab = ({ tab, isActive }) => (
    <FullTab
      isActive={isActive}
      key={tab.key}
      label={tab.label}
      renderIcon={this.renderIcon(tab.icon)}
    />
  )

  render() {
    return (
      <View style={{ flex: 1 }}>
        <View style={{ flex: 1 }}>
          {/* Your screen contents depending on current tab. */}
        </View>
        <BottomNavigation
          onTabPress={newTab => this.setState({ activeTab: newTab.key })}
          renderTab={this.renderTab}
          tabs={this.tabs}
        />
      </View>
    )
  }
}

Note: Out-of-the-box support for React Navigation (called NavigationComponent in earlier releases) was removed with v1. You can still use an earlier version, or integrate the Bottom Navigation on your own. Read more...

Documentation

You can also view the entire documentation on GitBook: https://timomeh.gitbook.io/material-bottom-navigation/

Notes

React Navigation Support

In contrary to earlier releases, this library does not support React Navigation out of the box (called NavigationComponent in earlier releases). React Navigation now ships with an own Material Bottom Navigation: createMaterialBottomTabNavigator.

The API of React Navigation changes quite frequently, and (until now) it wasn't always easy to keep track of changes and be up-to-date. Also I don't want to favor and promote React Navigation over other Navigation Libraries.

You can still implement the Bottom Navigation on your own, for example by using React Navigation's Custom Navigator.

If you integrate material-bottom-navigation with a navigation library in your project, feel free to share your knowledge by contributing to the Documentation or event create your own module which uses react-native-material-bottom-navigation.

Updated Material Design Specs

Google updated the Material Guidelines on Google I/O 2018 with new specifications, including a slightly changed Bottom Navigation and a new "App Bar Bottom" with a FAB in a centered cutout. react-native-material-bottom-navigation uses the older specs.

Contribute

Contributions are always welcome. Read more in the Contribution Guides.

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

Authors

Author

Contributors

See Contributors List. Thanks to everyone!

License

MIT, © 2017 - present Timo Mämecke