0.4.1 • Published 6 years ago
Share package 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 Prop Description Default TouchableItemA touchable component for bar item. TouchableOpacitystylesA styles object or function which return styles object, styles object has container、content、title、subTitle、activeTitle、badgeWrapper、badge、badgeTxt keys. isNeedContainerLayoutWhether need barItem container layout. computed isNeedContentLayoutWhether need barItem content layout. computed isIgnoreLayoutChangeWhether ignore layout change. computed
BarIndicator Prop Description Default 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 Prop Description Default BarItemThe bar item component. Tabify.BarItemBarIndicatorThe bar indicator component. Tabify.BarIndicatorstylesA styles object or function which return styles object, styles object has scroller、container keys. isScrollableWhether bar scrollable. isShowIndicatorWhether show bar indicator.
Tab Scene Pager Prop Description Default ViewPagerAndroidThe ViewPager for android. ViewPagerAndroidstylesA styles object or function which return styles object, styles object has container、content、scene keys.
Tabs Prop Description Default BarThe bar component. Tabify.BarPagerThe pager component. Tabify.PagerSceneThe scene component. Tabify.ScenestylesA styles object or function which return styles object, styles object has container keys.
Container Prop Description Default TabsThe tabs component. Tabify.TabsSceneThe scene component. Tabify.Scene