Skip to content
Swipeable SegmentedControl component for React Native apps
Branch: master
Clone or download
Latest commit 039ef16 Oct 16, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
example fix: fix vulnerability issues Oct 16, 2018
.gitignore initial commit May 1, 2018
LICENSE Create LICENSE May 3, 2018
README.md fix: add to-do Oct 16, 2018
index.js fix: change render method Oct 16, 2018
package-lock.json fix: fix vulnerability issues Oct 16, 2018
package.json fix: fix vulnerability issues Oct 16, 2018

README.md

react-native-segment-control

Platform npm version npm downloads License

Demo

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;

TO-DO's:

  • Add background color property
  • Add icons as tab titles
You can’t perform that action at this time.