# Migrate from @react-native-segmented-control/segmented-control

> Switch from @react-native-segmented-control/segmented-control to Patine UI: SegmentedControl, a segmented control that scrolls sideways when it does not fit, on iOS, Android and the web.

# Migrate from `@react-native-segmented-control/segmented-control`

```diff
- import SegmentedControl from '@react-native-segmented-control/segmented-control';
+ import { SegmentedControl } from 'patine-ui';

- <SegmentedControl
-   values={['Day', 'Week', 'Month']}
-   selectedIndex={index}
-   onChange={(e) => setIndex(e.nativeEvent.selectedSegmentIndex)}
- />
+ <SegmentedControl
+   items={[{ label: 'Day', value: 'day' }, { label: 'Week', value: 'week' }, { label: 'Month', value: 'month' }]}
+   value={view}
+   onValueChange={setView}
+ />
```

| segmented-control | Patine UI |
| --- | --- |
| `values` (strings) | `items` (`{ label, value, disabled?, icon? }`) |
| `selectedIndex` | `value` (the item's value, not its index) |
| `onChange(event)` / `onValueChange(label)` | `onValueChange(value, item)` |
| `enabled={false}` | `disabled: true` on each item |
| `tintColor` / `backgroundColor` | `theme={{ colors: { primary, surface } }}` or `styles={{ thumb, container }}` |
| — | scrolls sideways when the items don't fit, `variant="chips"`, `renderItem`, works on the web |

[`SegmentedControl`](../../components/segmented-control) has no native code, so it runs in Expo Go and on the web.

See [all migration guides](./index.mdx) for other libraries, and [Comparison](../comparison.mdx) for when another library is the better choice.
