使用三方组件

2017-12-27  本文已影响15人  叫我Button丶

react-native-material-tabs
注:操作均在项目根目录下
使用npm
npm install --save react-native-material-tabs
使用yarn
yarn add react-native-material-tabs
使用实例
import React, { Component } from 'react'; import { Platform, StyleSheet, Text, View, Button } from 'react-native'; import MaterialTabs from 'react-native-material-tabs'; export default class App extends Component<{}> { constructor(props) { super(props); this.state = { selectedTab:0 }; } render() { return ( <View style={{flex:1,marginTop:64}}> <MaterialTabs items={['One', 'Two', 'Three','four','five']} selectedIndex={this.state.selectedTab} onChange={index => this.setState({ selectedTab: index })} /> </View> ); } }

上一篇下一篇

猜你喜欢

热点阅读