npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-native-simple-tab

v1.0.8

Published

React Native Simple Tab

Downloads

16

Readme

react-native-simple-tab

A React Native Tab Navigation, made for simplicity, works on both Android and iOS.

demo

iOS (Left) | Android (right)

onlyIcon props on Nav set to true

Features

  • worked with (react-native-router-flux) or any kind of navigation solutions
  • cross-platform icons by default
  • simple and clean UI

Inspiration

Salestock Indonesia

Installation

  • npm install --save react-native-simple-tab react-native-vector-icons

After Installation (this step is required)

  • react-native link

Basic Usage

import React, { Component } from 'react';
import {
  StyleSheet,
  Text,
  View,
} from 'react-native';
import { Nav, Tab } from 'react-native-simple-tab';

class MyExample extends Component {
  constructor() {
    super();

    this.state = {
      page: 0,
    };

    this._onTabChange = this._onTabChange.bind(this);
  }

  _onTabChange(tabIndex) {
    this.setState({ page: tabIndex });
  }
  
  render() {
    return (
      <View style={styles.container}>
        <Text style={styles.welcome}>
          Welcome to React Native!
        </Text>
        <Text style={styles.myPackage}>
          react-native-cross-platform-tab
        </Text>
        <View style={{ flex: 1 }}>
          <Text style={styles.myText}>
            Selected Tab Index
          </Text>
          <Text style={styles.myTabIndex}>
            {this.state.page}
          </Text>
        </View>
        <Nav
          selected={this.state.page}
          onTabChange={this._onTabChange}>
            <Tab name="home" label="Home" />
            <Tab name="heart" label="Favorite" />
            <Tab name="cart" label="Cart" />
            <Tab name="shirt" label="Custom" />
            <Tab name="menu" label="Menu" />
        </Nav>
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#F5FCFF',
  },
  welcome: {
    flex: 1,
    fontSize: 20,
    textAlign: 'center',
    marginTop: 40,
  },
  myPackage: {
    flex: 1,
    textAlign: 'center',
    color: '#333333',
    marginBottom: 5,
  },
  myText: {
    textAlign: 'center',
  },
  myTabIndex: {
    fontSize: 20,
    textAlign: 'center',
    fontWeight: 'bold',
  },
});

export default MyExample;

More Icons

Check Out Here and use it's name into Tab name props.

Nav props

| Props | Type | Default | Description | | --- | --- | --- | --- | | selected | number | - | used to determine what tabIndex that currently selected | | onTabChange | function | () => {} | event onTabChange with param tabIndex | | backgroundColor | string | 'white' | Nav background color | | borderTopColor | string | '#DDDDDD' | Nav border top color | | height | number | 42 | Nav height | | onlyIcon | boolean | false | display only icon or icon with label | | pressOpacity | number | 0.7 | opacity when Tab be pressed (min: 0, max: 1) | | activeColor | string | 'black' | active color on all Tabs | | unActiveColor | string | 'gray' | unactive color on all Tabs | | iconSize | number | 22 | icon size on all Tabs | | fontSize | number | 11 | font size on all Tabs | | style | object | - | your own custom style for Nav wrapper |

Tab props

| Props | Type | isRequired? | Description | | --- | --- | --- | --- | | name | string | Required | used for icon name | | label | string | Optional | Tab label | | fontStyle | object | Optional | your own custom style for each Text on Tab | | style | object | Optional | your own custom style for Tab wrapper |

License

MIT