Repository navigation
feat: support the momentary prop on Android and web - #963
Merged
Naturalclar merged 1 commit intoNov 29, 2026
Merged
Naturalclar merged 1 commit into
Naturalclar merged 1 commit into
Conversation
`momentary` was only honoured on iOS, where UISegmentedControl's `isMomentary` stops a tapped segment from staying selected. The JavaScript implementation used on Android and web ignored it, so the control kept showing the slider and the bold active label, and tapping the selected segment again did nothing. When `momentary` is set, the JavaScript control now ignores `selectedIndex` for display purposes: - the slider is not rendered and every separator stays visible; - no segment gets the active label style or `accessibilityState.selected`; - every tap calls `onChange`/`onValueChange`, including repeated taps on the same segment, matching the native iOS behaviour. The README now lists the prop for iOS, Android and Web, and unit tests cover the rendering and callback behaviour. Fixes react-native-segmented-control#868
Naturalclar
approved these changes
Nov 29, 2026
Naturalclar
left a comment
Member
There was a problem hiding this comment.
LGTM, thank you! I also checked it on web and on an Android emulator.
Naturalclar
merged commit Nov 29, 2026
6e4ede6
into
react-native-segmented-control:master
6 checks passed
4 tasks
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
momentaryonly worked on iOS. On Android and web the prop was ignored: the slider and the bold active label stayed on the selected segment, and tapping that segment again did nothing. Fixes #868.With
momentaryset, the JS control (Android and web) now behaves like iOS's momentaryUISegmentedControl:selectedIndexis not shown: the slider isn't rendered, all separators stay visible, and no segment gets the active label style oraccessibilityState.selected.onChange/onValueChange, including repeated taps on the same segment. Tabs still give the usual press feedback.The README now lists
momentaryfor iOS, Android and Web.Test Plan
momentaryis turned off), and repeated taps on the same segment each fire both callbacks. The new tests fail without the change.pnpm exec jest --runInBand,pnpm lintandpnpm flow checkpass locally. The example app already has a momentary control, which now also applies on Android.