UNPKG

react-native-animated-segment-control

Version:

A custom `SegmentControl` component, pretty much similar to native's SegmentControl but with animation

33 lines (28 loc) 724 B
import React, {Component} from 'react' import {StyleSheet, View} from 'react-native' import SegmentControl from 'react-native-animated-segment-control' class App extends Component { onSegmentValueChange = index => { console.log('Selected Segment Index', index) } render() { return ( <View style={styles.container}> <SegmentControl values={['Segment1', 'Segment2', 'Segment3', 'Segment4',]} selectedIndex={1} onChange={this.onSegmentValueChange} /> </View> ); } } const styles = StyleSheet.create({ container: { flex: 1, justifyContent: 'center', alignItems: 'center', backgroundColor: '#F5FCFF', } }); export default App