Repository navigation
feat: add apportionsSegmentWidthsByContent prop for iOS - #964
Merged
Conversation
Expose UISegmentedControl's `apportionsSegmentWidthsByContent` so the width of each segment can follow the width of its content instead of every segment getting the same width. This keeps short labels compact and gives long labels room when horizontal space is limited. - iOS: export the prop from the view manager; it maps directly onto the UISegmentedControl property, so no extra native code is needed. - Add the prop to the Flow and TypeScript typings, with a type-level test. - Document it in the README as iOS-only and add it to the example app. Fixes react-native-segmented-control#883
Naturalclar
approved these changes
Nov 29, 2026
Naturalclar
left a comment
Member
There was a problem hiding this comment.
LGTM, thank you! I built it and checked the rendering in the iOS simulator, since CI doesn't compile the native code.
Naturalclar
merged commit Nov 29, 2026
c3e8e90
into
react-native-segmented-control:master
6 checks passed
3 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
Adds an
apportionsSegmentWidthsByContentprop that exposesUISegmentedControl'sapportionsSegmentWidthsByContent. With it, each segment's width follows its content instead of every segment getting the same width. This helps when horizontal space is limited and some labels are much shorter than others. Fixes #883.UISegmentedControlproperty, so no other native code is needed.Test Plan
types-test/typecheck.tsx.pnpm tscfails without theindex.d.tschange and passes with it.pnpm exec jest --runInBand,pnpm lintandpnpm flow checkpass locally.RCT_EXPORT_VIEW_PROPERTYline that follows the existing props.