Repository navigation
feat: add disabledIndices prop to disable individual segments - #936
Merged
Naturalclar merged 3 commits intoNov 23, 2026
Conversation
Allow disabling specific segments while the rest of the control stays interactive (react-native-segmented-control#615, react-native-segmented-control#519). - iOS: forward the new prop to the native view, which calls setEnabled:forSegmentAtIndex: for every segment. The state is reapplied when the values change, since UISegmentedControl drops it when its segments are rebuilt. - Android/web: disable and dim the matching tabs; a control disabled via `enabled` keeps all of its segments disabled. - Add typings (Flow and TypeScript), README docs and unit tests.
$ReadOnlyArray is flagged as a deprecated utility type by the Flow version the repository now uses (0.331, since react-native-segmented-control#939). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Naturalclar
merged commit Nov 23, 2026
2817e3d
into
react-native-segmented-control:master
6 checks passed
This was referenced Nov 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Adds a
disabledIndicesprop (array of segment indexes) so individual segments can be disabled while the rest of the control stays interactive. Closes #615, closes #519.setEnabled:forSegmentAtIndex:for each segment. It is reapplied whenevervalueschanges, becauseUISegmentedControlloses per-segment state when segments are rebuilt.enabled={false}, every segment stays disabled.Test Plan
accessibilityState), other segments still fireonChange,enabled={false}overrides, and out-of-range indexes are ignored.pnpm exec jest --runInBand,pnpm lint,pnpm flow checkandpnpm tscall pass.