The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 23, 08:00 UTC
fix(mobile): align iOS segmented controls with action colors (#20721)
Julius Marminge committed
Oct 16, 2026 at 20:40 UTC
79ad856b4e72b6d6f1409aca98bf439c1d170a94
3 files changed
+22
-11
apps/mobile/modules/t3-native-controls/ios/T3SegmentedControlView.swift
+19
-7
@@ -15,12 +15,15 @@ final class T3SegmentedControlView: ExpoView {
15
}
16
}
17
var selectedIndex = -1 { didSet { updateSelection() } }
18
- var trackColor: UIColor = .secondarySystemBackground { didSet { control.backgroundColor = trackColor } }
19
- var selectedColor: UIColor = .secondarySystemFill { didSet { control.selectedSegmentTintColor = selectedColor } }
20
- var textColor: UIColor = .label { didSet { updateColors() } }
21
- var mutedColor: UIColor = .secondaryLabel { didSet { updateColors() } }
18
+ var trackColor: UIColor = .secondarySystemBackground { didSet { if trackColor != oldValue { control.backgroundColor = trackColor } } }
19
+ var selectedColor: UIColor = .secondarySystemFill { didSet { if selectedColor != oldValue { control.selectedSegmentTintColor = selectedColor } } }
20
+ var textColor: UIColor = .label { didSet { if textColor != oldValue { updateColors() } } }
21
+ var mutedColor: UIColor = .secondaryLabel { didSet { if mutedColor != oldValue { updateColors() } } }
22
var appearance = "light" {
23
- didSet { overrideUserInterfaceStyle = appearance == "dark" ? .dark : .light }
23
+ didSet {
24
+ guard appearance != oldValue else { return }
25
+ overrideUserInterfaceStyle = appearance == "dark" ? .dark : .light
26
+ }
27
}
28
29
required init(appContext: AppContext? = nil) {
@@ -31,11 +34,20 @@ final class T3SegmentedControlView: ExpoView {
34
35
override func layoutSubviews() {
36
super.layoutSubviews()
34
- control.frame = bounds
37
+ guard control.frame != bounds else { return }
38
+ UIView.performWithoutAnimation {
39
+ control.frame = bounds
40
+ }
41
}
42
43
private func updateSelection() {
38
- control.selectedSegmentIndex = labels.indices.contains(selectedIndex) ? selectedIndex : UISegmentedControl.noSegment
44
+ let index = labels.indices.contains(selectedIndex) ? selectedIndex : UISegmentedControl.noSegment
45
+ // React echoes native selections while UIKit is still settling the glass lens.
46
+ guard control.selectedSegmentIndex != index else { return }
47
+ UIView.performWithoutAnimation {
48
+ control.selectedSegmentIndex = index
49
+ control.layoutIfNeeded()
50
+ }
51
}
52
53
private func updateColors() {
apps/mobile/src/components/ui/SegmentedControl.ios.tsx
+3
-3
@@ -29,14 +29,14 @@ export function SegmentedControl<Value extends string | number>(
29
) {
30
const { colors, colorScheme } = useControlTheme();
31
const trackColor = flattenThemeColor(
32
- themeColorWithAlpha(colors["--color-primary"], colorScheme === "dark" ? 0.18 : 0.07),
32
+ themeColorWithAlpha(colors["--color-prominent-action"], colorScheme === "dark" ? 0.18 : 0.07),
33
colors["--color-screen"],
34
);
35
const selectedColor =
36
- colorScheme === "dark" ? colors["--color-primary"] : colors["--color-secondary"];
36
+ colorScheme === "dark" ? colors["--color-prominent-action"] : colors["--color-secondary"];
37
const selectedTextColor =
38
colorScheme === "dark"
39
- ? colors["--color-primary-foreground"]
39
+ ? colors["--color-prominent-action-foreground"]
40
: colors["--color-secondary-foreground"];
41
return (
42
<View className={props.className}>
apps/mobile/src/features/pull-requests/PullRequestRouteScreen.tsx
-1
@@ -685,7 +685,6 @@ export function PullRequestRouteScreen({ route }: StaticScreenProps<PullRequestP
685
>
686
<PullRequestIdentity pr={identity} params={params} />
687
<SegmentedControl
688
- className={Platform.OS === "android" ? undefined : "bg-grouped-card"}
688
options={[
689
{ value: "overview", label: "Overview" },
690
...(guidesEnabled