# react-navtive-segment-control

> test

Latest version **0.3.5** (published 2025-04-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-navtive-segment-control
pnpm add react-navtive-segment-control
yarn add react-navtive-segment-control
bun add react-navtive-segment-control
```

## Health

**Score 40/100 (D)** — status: maintenance-mode.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.5 |
| Published | 2025-04-29 |
| First published | 2023-01-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >= 16.0.0 |
| Dependencies | 0 |
| Unpacked size | 40.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Yoshino-tuannguyen |
| Maintainers | yoshinoevil |
| Keywords | react-native, ios, android |

## Links

- npm: https://www.npmjs.com/package/react-navtive-segment-control
- Repository: https://github.com/nguyenanhtuan0799/RN-Segment-control
- Homepage: https://github.com/nguyenanhtuan0799/RN-Segment-control.git#readme
- Issues: https://github.com/nguyenanhtuan0799/RN-Segment-control.git/issues
- npm.io page: https://npm.io/package/react-navtive-segment-control

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 0.3.5 (latest) — 2025-04-29
- 0.3.3 — 2023-05-16
- 0.3.2 — 2023-05-15
- 0.3.1 — 2023-05-15
- 0.2.0 — 2023-05-15
- 0.1.4 — 2023-02-22
- 0.1.3 — 2023-02-11
- 0.1.2 — 2023-01-14
- 0.1.1 — 2023-01-14
- 0.1.0 — 2023-01-14

## README

# react-navtive-segment-control

Segment Control RN

## Installation

```sh
npm install react-navtive-segment-control
```

```sh
yarn add react-navtive-segment-control
```

## Usage

- Import Component

```sh
import { SegmentControl } from'react-navtive-segment-control';
```

```sh
 <SegmentControl
    segments={data}
    activeTab={activeTab}
    onPress={(value) => {
      console.log(value);
    }}
  />
```

- Example:

```
import react, {useState}from 'react'
import { RefObject, SegmentControl } from 'react-navtive-segment-control';

const data = [
  {label : "Left", icon : "left"},
  {label : "Right", icon : "right"}
  ]

const App = ()=>{
  const [activeTab,setActiveTab] = useState(0)
  return (
    <SegmentControl
      segments={data}
      activeTab={activeTab}
      onPress={(value) => {
        // value is object active in data
        console.log(value);
      }}
    />
  )
}
export default App
```

# **Reference**

## **Props**

---

### `segments`

an array of objects segments

| Type  | Required |
| ----- | -------- |
| array | Yes      |

### `activeTab`

index of array in segment

| Type   | Required |
| ------ | -------- |
| number | Yes      |

### `labelField`

key label you want to display (in the object of the segment array)

| Type   | Required | default |
| ------ | -------- | ------- |
| string | No       | title   |

### `iconField`

key icon you want to display (in the object of the segment array)

| Type   | Required | default |
| ------ | -------- | ------- |
| string | No       | icon    |

### `duration`

duration animated

| Type   | Required | default |
| ------ | -------- | ------- |
| number | No       | 300ms   |

### `style`

style container

| Type   | Required | default |
| ------ | -------- | ------- |
| object | No       |         |

### `activeStyle`

style box active

| Type   | Required | default |
| ------ | -------- | ------- |
| object | No       |         |

### `textStyle`

textStyle box

| Type   | Required | default |
| ------ | -------- | ------- |
| object | No       |         |

### `textActiveStyle`

textActiveStyle box active

| Type   | Required | default |
| ------ | -------- | ------- |
| object | No       |         |

### `onPress`

Press Segment

```
onPress((value,i)=>{})
```

| Type     | Required | default |
| -------- | -------- | ------- |
| function | No       |         |

### `updateActive`

updateActive of Ref segment

```
updateActive(index)
```

| Type     | Required | default |
| -------- | -------- | ------- |
| function | No       |         |

## License

MIT

---

Made with [create-react-native-library](https://github.com/callstack/react-native-builder-bob)

---
_Source: https://npm.io/package/react-navtive-segment-control · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
