Skip to content

Repository files navigation

react-native-segmented-control

react-native-segmentedControl for( Android / Ios )

Overview

SegmentedControl using react-native,support android and ios. Pages won't be rendered when you switch to other tabs,also save the status of invisible pages.

Installation

First you need to install react-native-segmented-control:

npminstallreact-native-segmented-control--save

Props

SegmentedControl

propvaluerequired/optionalcomment
defaultPagenumberoptionaldefault:0
itemFontSizenumberoptionaltext fontsize default:14
itemButtonActiveColorcoloroptionalActiveButton color
itemButtonColorcoloroptionaldefaultButton color
itemTextActiveColorcoloroptionalActiveText color
itemTextColorcoloroptionaldefaultText color
itemButtonViewStylestyleoptionalbutton container style
itemButtonBorderColorcoloroptionalbutton border color
itemHeaderViewStylestyleoptionalheader container style

SegmentedControl.Item

propvaluerequired/optionalcomment
titlestringrequiredtitle of item
onPressfunctionoptionalthe function will be called when item is selected.

Usage

importSegmentedControlfrom'react-native-segmented-control';<SegmentedControldefaultPage={1}itemButtonViewStyle={{width:200}}itemHeaderViewStyle={{paddingVertical:10,}}ref={e=>this.SegmentedControl=e}><SegmentedControl.Itemtitle={'直播'}><View>page0</View></SegmentedControl.Item><SegmentedControl.Itemtitle={'点播'}><View>page1</View></SegmentedControl.Item><SegmentedControl.Itemtitle={'影音'}><View>page2</View></SegmentedControl.Item></SegmentedControl>

###Methods

  • update(number) - select item.
this.SegmentedControl.update(number)

Screenshot

ios

android

About

react-native-segmentedControl for( Android / Ios )

Resources

Stars

12 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages