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-dynamic-tab-view-test

v1.0.1-0

Published

[![npm version](https://badge.fury.io/js/react-native-dynamic-tab-view.svg)](https://badge.fury.io/js/react-native-dynamic-tab-view)

Downloads

21

Readme

npm version

Features

example-gif

  • Easy to use and easy to read code
  • React-Native Javascript library built on top of FlatList.

Usecases

  • Dynamic tab data that can be populated by code (typically tabs are determined by an API call)
  • Ability to select any index (and just the zeroth index) as the default index.

How to use

Simply install by running yarn add react-native-dynamic-tab-view

Use it by

import DynamicTabView from 'react-native-dynamic-tab-view';
 <DynamicTabView
        data={dataSource}
        renderTab={renderTab}
        onChangeTab={onChangeTab}
        defaultIndex={defaultIndex}
        containerStyle={styles.container}
        headerBackgroundColor={'white'}
        headerUnderlayColor={'blue'}
      />

Here data is of the format

[
   { title: 'Tab1', key: 'item1' },
   { title: 'Tab2', key: 'item2' },
   { title: 'Tab3', key: 'item3' },
]

title sets the tab title key is used internally by React. It can be any unique string

Important Props

  • data data to tell the number of tabs and set the layout
  • renderTab method to render individual tab. It should return a valid React Component
  • onChangeTab callback that will be invoked when a user changes tab
  • defaultIndex index of the tab that will be selected by default.
  • containerStyle style for the dynamic tab view container
  • headerBackgroundColor background color for header
  • headerUnderlayColor Color for header underlay
  • headerTextStyle style for header text

Run the Example project

  1. cd Example
  2. npm install
  3. react-native run-android or react-native run-ios

or try expo: Dynamic Tab View Example

FAQs

Why are you building another TabView library?

At present, there are two tabView libraries that are out there

  • react-native-scrollable-tab-view
  • react-native-tab-view I have used both of them and I had multitude of issues with them.
  • react-native-scrollable-tab-view
    • Doesn't have proper maintainence. Last update was back in October. There are lot of open PRs.
    • Code is bloated and I tried fixing issues, but couldn't navigate my way through
    • Uses different code for Android and iOS and therefore I had issues like some view works with Android well and not with iOS and viceverca
  • react-native-tab-view
    • Uses different code for Android and iOS
    • Couldn't get default page selected working with this.
    • Built and works well for static views (dynamic tabs doesn't work very well with Android)

How's react-native-dynamic-tab-view different?

  • Uses same code for Android and iOS
  • More importantly, uses FlatList for creating the tabViews
  • Easy to read code

Contributors