Repository navigation
fix(mobile): render full segmented-control option labels - #8522
Conversation
The shared segmented control clamped every option to a single line and let the platform shrink the font. The label sat in a content-sized Text inside a centre-aligned segment, so when a label was wider than its equal-width segment the shrink found no width to fit into and the text was cut at the segment edge with no ellipsis. Hindi "7 दिन" in the spend-alert period control showed up as "7". The label now fills the segment width and wraps onto as many lines as it needs, and the row keeps every segment at the tallest height so a wrapped choice never looks uneven. Segments gain vertical padding so two-line labels keep balanced insets. Tests cover the invariant instead of the old clamp: no line cap, no font shrink, and no content-sized label box.
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Executive SummaryThe shared segmented control now lets each option label stretch to its segment width and wrap without a line cap or font shrink, with Assumptions: Files Reviewed (3 files)
No memory-leak surface was introduced: the change only edits class names, removes two text props, and rewrites test assertions, with no new effects, listeners, timers, or subscriptions. No markdown documentation files are touched. Reviewed by deepseek-flash-latest · Input: 50.6K · Output: 6.3K · Cached: 329.5K Review guidance: REVIEW.md from base branch |
|
bot: Spend-alerts period control in Hindi on the branch, personal scope, owned fake account on the local dev stack.
The control no longer clamps a label to one shrunken line; a label that does not fit its segment wraps inside it instead of being cut. |



Evidence
Evidence: partially demonstrated — the fixed rendering was observed on the Android emulator at the default display size and one density step up, and on the iOS simulator through the lane, where the Hindi period control shows
24 घंटे,7 दिनand30 दिनin full; the previous one-line clamp was observed through the component tests, which fail against the base version of the control.What changed
apps/mobile/src/components/ui/segmented-control.tsxclamped every option label to one line withnumberOfLines={1}andadjustsFontSizeToFit. The label sat in a content-sizedTextinside a centre-aligned segment, so a label wider than its equal-width segment had no width constraint to shrink into and was cut at the segment edge with no ellipsis. The Hindi period option7 दिनon the spend-alerts screen rendered as7.The shared control now:
justify-centerwithoutitems-center), so a long label wraps inside the pill instead of overflowing it;py-2, so a one-line segment stays 44dp and a two-line segment gets balanced insets.Every caller renders the same control, so the fix covers all of them: appearance switcher, New Session "Changes", MCP auth pickers, model catalog tabs, profile owner picker, part-detail text mode, spend alerts.
Tests now assert the invariant instead of the clamp: no line cap, no font shrink, no content-sized label box that would clip a long label.
No schema, API, or native change. JavaScript only; no new dev client is needed.
End-to-end evidence
Unit and component tests (
apps/mobile):vitest run src/components/ui/segmented-control.test.ts src/components/ui/segmented-control.mounted.test.tsx— 3 tests pass on the branch. With the base version ofsegmented-control.tsxplanted back, all 3 fail (numberOfLinesis1), so the assertions cover the old defect.settings-screens-a11y,new-session-configure-form,part-detail-sheet,part-detail-images,chat/,profiles/,spend-alerts-screen,preferences-screen,organization/): 40 files, 468 tests pass.oxlinton the changed files: 0 warnings, 0 errors.tsc --noEmit: clean.Android (emulator
omp36, API 36, local dev stack, app language Hindi, personal spend-alerts scope, owned fake account):अवधिselector underसीमा पार होना.24 घंटे,7 दिन,30 दिनeach render in full, all three on one line, same segment height.uiautomatorbounds confirm the label text fills its segment (stretched, not content-sized), and OCR of the captures reads all three labels whole.iOS (simulator through the lane, cached branch dev client, same Hindi personal spend-alerts screen):
अवधिshows24 घंटे,7 दिन,30 दिनin full, one line each, equal segment heights.Limitation stated plainly: on this AVD and simulator image the pre-fix control happened to fit the three Hindi labels, so the device captures show the label shrinking/centring mechanism is gone and the full text renders, while the reported clip itself is proven by the failing-before component tests rather than by a device screenshot of the old code.
Screenshots
Attached in a follow-up comment: Android at the default display size, Android one Display size step up, and the iOS simulator, all on the same Hindi spend-alerts period control.
Proxy answers
The owner's proxy gave these answers in the owner's place.
Answer: Allow two lines, no autosize
Confidence: 0.75 · Precedent: UX and design quality: best-in-class, consistent elements, no silent cuts; the brief asks segments to "fit their content or wrap"
Answer: Fix shared control for every caller
Confidence: 0.85 · Precedent: Fix the root cause and the class — "fix this for all shared services model pickers on all surfaces"
Answer: Yes, lease the iOS lane
Confidence: 0.70 · Precedent: Verify on both iOS and Android — "Both iOS and Android need to be verified"; the iOS lane opens when the agent asks
Answer: No cap: wrap as far as needed
Confidence: 0.45 · Precedent: UX and design quality: fix the whole class of each defect; the brief asks for full labels that fit or wrap, and an ellipsis would still cut the label at large scale.
Answer: Add py-2 (44dp single line, 56dp two lines)
Confidence: 0.75 · Precedent: UX and design quality: consistent, right-sized padding and vertically centered text.
Answer: Personal scope only
Confidence: 0.60 · Precedent: Do the least work possible with no drop in quality; the fix is in the shared control, which renders the same labels and widths in personal scope.
Answer: Density step only
Confidence: 0.55 · Precedent: Never change font scaling — always use the default; the brief's "large display size" maps to Android's Display size, which is the density setting.