importReactfrom'react';import{View,Text,StyleSheet}from'react-native';importSegmentControlfrom'react-native-segment-control';constOne=()=>{return<Textstyle={styles.text}>This is first view</Text>;};constTwo=()=>{return<Textstyle={styles.text}>This is second view</Text>;};constsegments=[{title: 'One',view: One},{title: 'Two',view: Two}];constApp=()=>{return(<Viewstyle={styles.container}><SegmentControlsegments={segments}/></View>);};conststyles=StyleSheet.create({container: {flex: 1,backgroundColor: '#F5F7FA',justifyContent: 'center'},text: {alignSelf: 'center',margin: 50}});exportdefaultApp;
TO-DO's:
Add background color property
Add icons as tab titles
About
Swipeable SegmentedControl component for React Native apps