react-native-segment-control

1.0.5 • Public • Published

react-native-segment-control

A React Native swipeable SegmentedControl component for iOS and Android

Installation

$ npm install react-native-segment-control --save

Example

import React from 'react';
import { View, Text, StyleSheet } from 'react-native';
import SegmentControl from 'react-native-segment-control';
 
const One = () => {
  return <Text style={styles.text}>This is first view</Text>;
};
const Two = () => {
  return <Text style={styles.text}>This is second view</Text>;
};
const segments = [
  {
    title: 'One',
    view: One
  },
  {
    title: 'Two',
    view: Two
  }
];
const App = () => {
  return (
    <View style={styles.container}>
      <SegmentControl segments={segments} />
    </View>
  );
};
 
const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#F5F7FA',
    justifyContent: 'center'
  },
  text: {
    alignSelf: 'center',
    margin: 50
  }
});
 
export default App;

Package Sidebar

Install

npm i react-native-segment-control

Weekly Downloads

23

Version

1.0.5

License

MIT

Unpacked Size

322 MB

Total Files

4838

Last publish

Collaborators

  • ainurb
  • nbolatov