Giter VIP home page Giter VIP logo

react-native-navbar's Introduction

Customizable navbar for react-native

react-native-side-menu demo

Content

Examples

Getting started

  • Install react-native-navbar:

    • By using yarn:
      $ yarn add react-native-navbar
      
    • By using npm:
      $ npm install react-native-navbar --save
      
  • Import it in the file where you want to use it:

    import NavigationBar from 'react-native-navbar';
  • Add it to your React element tree:

const styles = {
  container: {
    flex: 1,
  },
};

const rightButtonConfig = {
  title: 'Next',
  handler: () => alert('hello!'),
};

const titleConfig = {
  title: 'Hello, world',
};

function ComponentWithNavigationBar() {
  return (
    <View style={styles.container}>
      <NavigationBar
        title={titleConfig}
        rightButton={rightButtonConfig}
      />
    </View>
  );
}

That's it, you're ready to go!

API

  • style - (Object, Array) - Style object or array of style objects
  • containerStyle - (Object) - Style object for styling navbar container
  • tintColor - (String) - NavigationBar's tint color
  • statusBar - (Object):
    • style - ('light-content' or 'default') - Style of statusBar
    • hidden - (Boolean)
    • tintColor - (String) - Status bar tint color
    • hideAnimation - ('fade', 'slide', 'none') - Type of statusBar hide animation
    • showAnimation - ('fade', 'slide', 'none') - Type of statusBar show animation
  • leftButton / rightButton - (Object, React Element) - Either plain object with configuration, or React Element which will be used as a custom left/right button element. Configuration object has following keys:
    • title - (String) - Button's title
    • tintColor - (String) - Button's text color
    • style - (Object, Array) - Style object or array of style objects
    • handler - (Function) - onPress function handler
    • disabled - (Boolean) - If true, disable interactions for this button.
    • accessible - (Boolean) - Indicates that the view is an accessibility element
    • accessibilityLabel - (String, React Element) - Overrides the text that's read by the screen reader for the button.
  • title - (Object, React Element) - Either plain object with configuration, or React Element which will be used as a custom title element. Configuration object has following keys:
    • title - (String) - Button's title
    • style - (Object, Array, Number) - Style object or array of style objects
    • tintColor - (String) - Title's text color

Usage with Webpack

This module uses JSX syntax and requires a compiler such as babel. React Native's packager runs this automatically but if you use Webpack be sure to compile this module from your dependencies

loaders: [{
  test: /\.js$/,
   include: [
     path.resolve(__dirname, "src"),
     path.resolve(__dirname, "node_modules/react-native-navbar")
   ],
  loader: 'babel',
  query: { stage: 0, plugins: [] }
}]

Questions?

Feel free to ping me on twitter If you want to report a bug, please submit an issue!

react-native-navbar's People

Contributors

kureev avatar skevy avatar alinz avatar morenoh149 avatar jonasjonny avatar jonathanwi avatar robrichard avatar mirza-s avatar chirag04 avatar xing-zheng avatar vincent178 avatar markdowney avatar kujohn avatar voronianski avatar bilalbudhani avatar doxiaodong avatar chenxsan avatar taf2 avatar leemarreros avatar mokto avatar mwilc0x avatar grabbou avatar kh0r avatar jeremybarbet avatar jamesnocentini avatar invibot avatar idris avatar carbureted avatar chetstone avatar yogiben avatar

Watchers

James Cloos avatar

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.