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> ); } }
网友评论