react-native组件(5)--(react-native-segmented-control-tab)

安装

npm install react-native-segmented-control-tab --save

用法
import SegmentedControlTab from 'react-native-segmented-control-tab'

class ConsumerComponent extends Component {

    constructor(){
      super()
      this.state = {
        selectedIndex: 0,
      };
    }

    handleIndexChange = (index) => {
      this.setState({
        ...this.state,
        selectedIndex: index,
      });
    }

    render() {
        return (
            <View>
                <SegmentedControlTab
                    values={['First', 'Second', 'Third']}
                    selectedIndex={this.state.selectedIndex}
                    onTabPress={this.handleIndexChange}
                    />
            </View>
        );
    }
}
属性
属性名 描述 类型
values titles array
selectedIndex 选择的索引 number
selectedIndices 好像是多选的时候选择的索引 arrayOf(PropTypes.number)
multiple 是否要多选 (默认false) bool
borderRadius 可能是边框我没试过 number
tabsContainerStyle 看类型就是样式了(没试过谁有兴趣可以试试) object(styles)
tabStyle 看类型就是样式了(没试过谁有兴趣可以试试) object(styles)
tabTextStyle 看类型就是样式了(没试过谁有兴趣可以试试) object(styles)
activeTabStyle 看类型就是样式了(没试过谁有兴趣可以试试) object(styles)
activeTabTextStyle 看类型就是样式了(没试过谁有兴趣可以试试) object(styles)
onTabPress 回掉函数 func
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容