0.4.1 • Published 5 years ago

react-native-tabify v0.4.1

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

react-native-tabify

Easy to create multi-style tabs for React Native

Installation

$ npm install --save react-native-tabify

Usage

import Tabify from 'react-native-tabify'

const NewTabify = Tabify.create({ ... })

function Component() {
  return (
    <NewTabify.Tabs>
      <NewTabify.Tab name="tab1" title="Tab 1">
        <View style={{ backgroundColor: '#f00', flex: 1 }} />
      </NewTabify.Tab>
      <NewTabify.Tab name="tab2" title="Tab 2">
        <View style={{ backgroundColor: '#0f0', flex: 1 }} />
      </NewTabify.Tab>
      <NewTabify.Tab name="tab3" title="Tab 3">
        <View style={{ backgroundColor: '#00f', flex: 1 }} />
      </NewTabify.Tab>
    </NewTabify.Tabs>
  )
}

Properties

BarItem

PropDescriptionDefault
TouchableItemA touchable component for bar item.TouchableOpacity
stylesA styles object or function which return styles object, styles object has containercontenttitlesubTitleactiveTitlebadgeWrapperbadgebadgeTxt keys.
isNeedContainerLayoutWhether need barItem container layout.computed
isNeedContentLayoutWhether need barItem content layout.computed
isIgnoreLayoutChangeWhether ignore layout change.computed

BarIndicator

PropDescriptionDefault
stylesA styles object or function which return styles object, styles object has container keys.
getWidthA function that is called when get interpolate outputRange of indicator width. The function is called with a layouts argument.layouts => layouts.map(d => d.container.width)
getOffsetA function that is called when get interpolate outputRange of indicator offset. The function is called with layouts and widths arguments.(layouts, widths) => layouts.map((d, i) => (d.container.x + (d.container.width - widths[i]) / 2))
renderThe indicator render function.props => <Animated.View pointerEvents="none" {...props} />

Bar

PropDescriptionDefault
BarItemThe bar item component.Tabify.BarItem
BarIndicatorThe bar indicator component.Tabify.BarIndicator
stylesA styles object or function which return styles object, styles object has scrollercontainer keys.
isScrollableWhether bar scrollable.
isShowIndicatorWhether show bar indicator.

Tab

PropDescriptionDefault

Scene

PropDescriptionDefault

Pager

PropDescriptionDefault
ViewPagerAndroidThe ViewPager for android.ViewPagerAndroid
stylesA styles object or function which return styles object, styles object has containercontentscene keys.

Tabs

PropDescriptionDefault
BarThe bar component.Tabify.Bar
PagerThe pager component.Tabify.Pager
SceneThe scene component.Tabify.Scene
stylesA styles object or function which return styles object, styles object has container keys.

Container

PropDescriptionDefault
TabsThe tabs component.Tabify.Tabs
SceneThe scene component.Tabify.Scene