React Native Segmented control
npm install segmented-control-rnReact Native Segmented control
``sh`
npm install segmented-control-rn
`js
import React, { useState } from 'react';
import { StyleSheet, Text, View, Image } from 'react-native';
import SegmentedControl from "segmented-control-rn";
const INACTIVE_COLOR = 'rgba(0, 0, 0, 0.5)';
const ACTIVE_COLOR = 'rgb(0, 0, 0)';
const segments = [
{
active:
inactive:
},
{
active:
inactive:
},
{
active:
inactive:
},
];
// ...
const [activeIndex, setActiveIndex] = useState(0);
return (
segments={segments}
selectedIndex={activeIndex}
/>
);
`
Background color of the Segmented Control.
| Type | Required | Default value |
| ------ | -------- | ------------- |
| string | No | #E6EAF2 |
Primary color of the active segment
| Type | Required | Default value |
| ------ | -------- | ------------- |
| string | No | #FFFFFF |
Index of the selected segment.
| Type | Required | Default value |
| ------ | -------- | ------------- |
| number | Yes | 0 |
If it true then makes segments disabled and sets opacity to 0.4`.
| Type | Required | Default value |
| ------ | -------- | ------------- |
| number | No | false |
See the contributing guide to learn how to contribute to the repository and the development workflow.
MIT