Skip to main content
Version: 0.60

SegmentedControlIOS

Deprecated. Use @react-native-community/segmented-control instead.

Uses SegmentedControlIOS to render a UISegmentedControl iOS.

Programmatically changing selected indexโ€‹

The selected index can be changed on the fly by assigning the selectedIndex prop to a state variable, then changing that variable. Note that the state variable would need to be updated as the user selects a value and changes the index, as shown in the example below.

Exampleโ€‹


Reference

Propsโ€‹

Inherits View Props.

enabledโ€‹

If false the user won't be able to interact with the control. Default value is true.

TypeRequired
boolNo

momentaryโ€‹

If true, then selecting a segment won't persist visually. The onValueChange callback will still work as expected.

TypeRequired
boolNo

onChangeโ€‹

Callback that is called when the user taps a segment; passes the event as an argument

TypeRequired
functionNo

onValueChangeโ€‹

Callback that is called when the user taps a segment; passes the segment's value as an argument

TypeRequired
functionNo

selectedIndexโ€‹

The index in props.values of the segment to be (pre)selected.

TypeRequired
numberNo

tintColorโ€‹

Accent color of the control.

TypeRequired
stringNo

valuesโ€‹

The labels for the control's segment buttons, in order.

TypeRequired
array of stringNo