0.3.0 • Published 6 years ago

@farbod_/react-native-tab v0.3.0

Weekly downloads
-
License
ISC
Repository
github
Last release
6 years ago

React Native Tab

[NPM Version

Tab Component for React-Native (android & ios)

Installation

$ npm install --save @farbod_/react-native-tab

Usage

Add Tab and pass children to it.

import React, { Component } from 'react';
import {
  View,
  Text,
  StyleSheet
} from 'react-native';
import Tab from '@farbod_/react-native-tab';

export default class App extends Component {
  render() {
    return (
      <View style={styles.container}>
        <Tab>
          <View
            name="First"
            style={{ flex: 1, backgroundColor: '#0f0' }}
          >
            <Text>Tab 1</Text>
          </View>

          <View
            name="Second"
            style={{ flex: 1, backgroundColor: '#f00' }}
          >
            <Text>Tab 2</Text>
          </View>

          <View
            name="Third"
            style={{ flex: 1, backgroundColor: '#00f' }}
          >
            <Text>Tab 3</Text>
          </View>

          <View
            name="Fourth"
            style={{ flex: 1, backgroundColor: '#f0f' }}
          >
            <Text>Tab 4</Text>
          </View>
        </Tab>
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#F5FCFF',
  }
});

By default tab buttons scrolling. For Change, Pass 'mode' prop to component.

mode="scroll"

mode="normal"

Tab Props

PropValuesAction
stylestyle objectextra styles for tab component container
tabBarStylestyle objectextra styles for tab bar
buttonTextStylestyle objectextra styles for tab buttons text
rollStylestyle objectextra styles for tab buttons roll
modenormal, scrollmake tab buttons static or scrollable
reversetrue, falsedirection of tab Buttons and Views

View Props

PropValuesAction
namestringshow name of tab
onPressfunctionaction we need accur when click on tab (body not render for this view)
0.3.0

6 years ago

0.2.0

6 years ago

0.1.4

6 years ago

0.1.3

6 years ago