@devries-cameron20 / t3code Mirror · read-only / commits / 791feeb060
Fork 0

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, 09:15 UTC

refactor(mobile): keep segmented controls native (#18532)

Julius Marminge committed Oct 15, 2026 at 15:46 UTC 791feeb060e8cfeb1775e1682b937a72d75137e6
12 files changed +317 -196
apps/mobile/package.json
+1 -1
@@ -164,7 +164,7 @@
164 },
165 "autolinking": {
166 "buildFromSource": [
167 - "expo-ui",
167 + "@expo/ui",
168 "expo-notifications",
169 "react-native-screens",
170 "react-native-reanimated",
apps/mobile/src/components/MaterialSegmentedButtons.android.tsx deleted
-37
@@ -1,37 +0,0 @@
1 -import { SegmentedButton, SingleChoiceSegmentedButtonRow, Text } from "@expo/ui/jetpack-compose";
2 -import { defaultMinSize, fillMaxWidth } from "@expo/ui/jetpack-compose/modifiers";
3 -import { useAppearancePreferences } from "../features/settings/appearance/AppearancePreferencesProvider";
4 -import { useScaledTextRole } from "../features/settings/appearance/useScaledTextRole";
5 -import type { SegmentedControlProps } from "./SegmentedControl.types";
6 -
7 -/** Compose content shared by screen controls and native dialogs, inside their existing Host. */
8 -export function MaterialSegmentedButtons<Value extends number | string>(
9 - props: SegmentedControlProps<Value>,
10 -) {
11 - const { themeVariables: colors } = useAppearancePreferences();
12 - const typography = useScaledTextRole("footnote");
13 - return (
14 - <SingleChoiceSegmentedButtonRow modifiers={[fillMaxWidth()]}>
15 - {props.options.map((option) => (
16 - <SegmentedButton
17 - key={String(option.value)}
18 - selected={option.value === props.selected}
19 - onClick={() => props.onSelect(option.value)}
20 - modifiers={[defaultMinSize({ minHeight: 48 })]}
21 - colors={{
22 - activeContainerColor: colors["--color-secondary"],
23 - activeContentColor: colors["--color-secondary-foreground"],
24 - inactiveContainerColor: "transparent",
25 - inactiveContentColor: colors["--color-foreground"],
26 - activeBorderColor: colors["--color-border"],
27 - inactiveBorderColor: colors["--color-border"],
28 - }}
29 - >
30 - <SegmentedButton.Label>
31 - <Text style={typography}>{option.label}</Text>
32 - </SegmentedButton.Label>
33 - </SegmentedButton>
34 - ))}
35 - </SingleChoiceSegmentedButtonRow>
36 - );
37 -}
apps/mobile/src/components/MaterialSegmentedControl.android.tsx deleted
-40
@@ -1,40 +0,0 @@
1 -import { Host } from "@expo/ui/jetpack-compose";
2 -import { MaterialSegmentedButtons } from "./MaterialSegmentedButtons.android";
3 -import { View } from "react-native";
4 -
5 -import { useAppearancePreferences } from "../features/settings/appearance/AppearancePreferencesProvider";
6 -import type { SegmentedControlProps } from "./SegmentedControl.types";
7 -
8 -export function MaterialSegmentedControl<Value extends number | string>(
9 - props: SegmentedControlProps<Value>,
10 -) {
11 - const { themeAppearance } = useAppearancePreferences();
12 - return (
13 - <View className={props.className}>
14 - <View importantForAccessibility="no-hide-descendants">
15 - <Host
16 - matchContents={{ vertical: true }}
17 - colorScheme={themeAppearance}
18 - ignoreSafeAreaKeyboardInsets
19 - style={{ width: "100%" }}
20 - >
21 - <MaterialSegmentedButtons {...props} />
22 - </Host>
23 - </View>
24 - <View pointerEvents="none" className="absolute inset-0 flex-row">
25 - {props.options.map((option) => (
26 - <View
27 - key={String(option.value)}
28 - accessible
29 - accessibilityRole={props.role ?? "button"}
30 - accessibilityLabel={option.accessibilityLabel ?? option.label}
31 - accessibilityState={{ selected: option.value === props.selected }}
32 - accessibilityActions={[{ name: "activate" }]}
33 - onAccessibilityAction={() => props.onSelect(option.value)}
34 - className="flex-1"
35 - />
36 - ))}
37 - </View>
38 - </View>
39 - );
40 -}
apps/mobile/src/components/MaterialSegmentedControl.tsx deleted
-7
@@ -1,7 +0,0 @@
1 -import type { SegmentedControlProps } from "./SegmentedControl.types";
2 -
3 -export function MaterialSegmentedControl<Value extends number | string>(
4 - _props: SegmentedControlProps<Value>,
5 -) {
6 - return null;
7 -}
apps/mobile/src/components/SegmentedControl.android.tsx new
+86
@@ -0,0 +1,86 @@
1 +import {
2 + Host,
3 + SegmentedButton,
4 + SingleChoiceSegmentedButtonRow,
5 + Text,
6 +} from "@expo/ui/jetpack-compose";
7 +import { defaultMinSize, fillMaxWidth } from "@expo/ui/jetpack-compose/modifiers";
8 +import { useAppearancePreferences } from "../features/settings/appearance/AppearancePreferencesProvider";
9 +import { useScaledTextRole } from "../features/settings/appearance/useScaledTextRole";
10 +import { View } from "react-native";
11 +
12 +import { useControlTheme } from "./useControlTheme";
13 +import type { SegmentedControlProps } from "./SegmentedControl.types";
14 +
15 +function HostedSegmentedControl<Value extends number | string>(
16 + props: SegmentedControlProps<Value>,
17 +) {
18 + const { colorScheme } = useControlTheme();
19 + return (
20 + <View className={props.className}>
21 + <View importantForAccessibility="no-hide-descendants">
22 + <Host
23 + matchContents={{ vertical: true }}
24 + colorScheme={colorScheme}
25 + ignoreSafeAreaKeyboardInsets
26 + style={{ width: "100%" }}
27 + >
28 + <SegmentedControlContent {...props} />
29 + </Host>
30 + </View>
31 + <View pointerEvents="none" className="absolute inset-0 flex-row">
32 + {props.options.map((option) => (
33 + <View
34 + key={String(option.value)}
35 + accessible
36 + accessibilityRole={props.role ?? "button"}
37 + accessibilityLabel={option.accessibilityLabel ?? option.label}
38 + accessibilityState={{ selected: option.value === props.selected }}
39 + accessibilityActions={[{ name: "activate" }]}
40 + onAccessibilityAction={() => props.onSelect(option.value)}
41 + className="flex-1"
42 + />
43 + ))}
44 + </View>
45 + </View>
46 + );
47 +}
48 +
49 +export type { SegmentedControlProps } from "./SegmentedControl.types";
50 +
51 +/** Compose content shared by screen controls and native dialogs, inside their existing Host. */
52 +function SegmentedControlContent<Value extends number | string>(
53 + props: SegmentedControlProps<Value>,
54 +) {
55 + const { themeVariables: colors } = useAppearancePreferences();
56 + const typography = useScaledTextRole("footnote");
57 + return (
58 + <SingleChoiceSegmentedButtonRow modifiers={[fillMaxWidth()]}>
59 + {props.options.map((option) => (
60 + <SegmentedButton
61 + key={String(option.value)}
62 + selected={option.value === props.selected}
63 + onClick={() => props.onSelect(option.value)}
64 + modifiers={[defaultMinSize({ minHeight: 48 })]}
65 + colors={{
66 + activeContainerColor: colors["--color-secondary"],
67 + activeContentColor: colors["--color-secondary-foreground"],
68 + inactiveContainerColor: "transparent",
69 + inactiveContentColor: colors["--color-foreground"],
70 + activeBorderColor: colors["--color-border"],
71 + inactiveBorderColor: colors["--color-border"],
72 + }}
73 + >
74 + <SegmentedButton.Label>
75 + <Text style={typography}>{option.label}</Text>
76 + </SegmentedButton.Label>
77 + </SegmentedButton>
78 + ))}
79 + </SingleChoiceSegmentedButtonRow>
80 + );
81 +}
82 +
83 +/** Content is for callers already inside an Android native Host. */
84 +export const SegmentedControl = Object.assign(HostedSegmentedControl, {
85 + Content: SegmentedControlContent,
86 +});
apps/mobile/src/components/SegmentedControl.tsx
+39 -77
@@ -1,89 +1,51 @@
1 -import { useEffect, useState } from "react";
2 -import { I18nManager, Platform, Pressable, View } from "react-native";
3 -import Animated, {
4 - Easing,
5 - ReduceMotion,
6 - useAnimatedStyle,
7 - useSharedValue,
8 - withTiming,
9 -} from "react-native-reanimated";
10 -import { AppText as Text } from "./AppText";
11 -import { cn } from "../lib/cn";
12 -import { MaterialSegmentedControl } from "./MaterialSegmentedControl";
1 +import { Picker } from "@expo/ui/swift-ui";
2 +import { View } from "react-native";
3 +
4 +import { useControlTheme } from "./useControlTheme";
5 +import { NativeThemeHost } from "./NativeThemeHost";
6 import type { SegmentedControlProps } from "./SegmentedControl.types";
7
8 export type { SegmentedControlProps } from "./SegmentedControl.types";
9
17 -export function SegmentedControl<Value extends number | string>(
10 +/** Let UIKit own segment sizing, selection, and accessibility through SwiftUI. */
11 +export function SegmentedControl<Value extends string | number>(
12 props: SegmentedControlProps<Value>,
13 ) {
20 - const compact = props.size === "compact";
21 - const [width, setWidth] = useState(0);
22 - const index = Math.max(
23 - 0,
24 - props.options.findIndex((option) => option.value === props.selected),
25 - );
26 - const position = useSharedValue(index);
27 - useEffect(() => {
28 - position.set(
29 - withTiming(index, {
30 - duration: 200,
31 - easing: Easing.out(Easing.cubic),
32 - reduceMotion: ReduceMotion.System,
33 - }),
34 - );
35 - }, [index, position]);
36 - const indicatorStyle = useAnimatedStyle(() => ({
37 - transform: [
38 - {
39 - translateX:
40 - ((position.value * width) / props.options.length) * (I18nManager.isRTL ? -1 : 1),
41 - },
42 - ],
43 - }));
44 - if (Platform.OS === "android") {
45 - return <MaterialSegmentedControl {...props} />;
46 - }
14 + const { colors } = useControlTheme();
15 return (
48 - <View
49 - accessible={false}
50 - onLayout={(event) => setWidth(event.nativeEvent.layout.width)}
51 - className={cn(
52 - "flex-row overflow-hidden",
53 - "rounded-full border-continuous bg-card",
54 - props.className,
55 - )}
56 - >
57 - <Animated.View
58 - pointerEvents="none"
59 - className="absolute inset-y-0 rounded-full bg-secondary"
60 - style={[{ width: `${100 / props.options.length}%`, start: 0 }, indicatorStyle]}
61 - />
62 - {props.options.map((option) => {
63 - const active = option.value === props.selected;
64 - return (
65 - <Pressable
16 + <View className={props.className}>
17 + <View accessibilityElementsHidden>
18 + <NativeThemeHost matchContents={{ vertical: true }} style={{ width: "100%" }}>
19 + <Picker
20 + selection={props.selected}
21 + onSelectionChange={props.onSelect}
22 + segments={props.options.map((option) => ({
23 + label: option.label,
24 + value: option.value,
25 + }))}
26 + segmentColors={{
27 + background: colors["--color-card"],
28 + selectedBackground: colors["--color-secondary"],
29 + text: colors["--color-foreground-muted"],
30 + selectedText: colors["--color-secondary-foreground"],
31 + }}
32 + />
33 + </NativeThemeHost>
34 + </View>
35 + <View pointerEvents="none" className="absolute inset-0 flex-row">
36 + {props.options.map((option) => (
37 + <View
38 key={String(option.value)}
67 - accessibilityRole={Platform.OS === "ios" ? "button" : (props.role ?? "button")}
39 + accessible
40 + accessibilityRole={props.role ?? "button"}
41 accessibilityLabel={option.accessibilityLabel ?? option.label}
69 - accessibilityState={{ selected: active }}
70 - onPress={() => props.onSelect(option.value)}
71 - className={cn(
72 - "flex-1 items-center justify-center rounded-full",
73 - compact ? "h-9" : "h-11",
74 - )}
75 - >
76 - <Text
77 - className={cn(
78 - compact ? "text-xs" : "text-sm",
79 - active ? "font-t3-medium text-secondary-foreground" : "text-foreground-muted",
80 - )}
81 - >
82 - {option.label}
83 - </Text>
84 - </Pressable>
85 - );
86 - })}
42 + accessibilityState={{ selected: option.value === props.selected }}
43 + accessibilityActions={[{ name: "activate" }]}
44 + onAccessibilityAction={() => props.onSelect(option.value)}
45 + className="flex-1"
46 + />
47 + ))}
48 + </View>
49 </View>
50 );
51 }
apps/mobile/src/components/SegmentedControl.types.ts
+1 -1
@@ -6,7 +6,7 @@ export interface SegmentedControlProps<Value extends number | string> {
6 }[];
7 readonly selected: Value;
8 readonly onSelect: (value: Value) => void;
9 - /** Compact sizing applies to the non-Material control. */
9 + /** Native controls determine their own sizing. Kept for existing callers. */
10 readonly size?: "default" | "compact";
11 /** "tab" for the view switcher; filters stay plain buttons. */
12 readonly role?: "tab" | "button";
apps/mobile/src/dependency-graph.test.ts
+1 -1
@@ -269,7 +269,7 @@ describe("mobile dependency graph", () => {
269 ["lib", "features", 7, "lib must not add imports from features"],
270 // components -> features: mostly the appearance preferences provider
271 // and the layout toolbar bridges.
272 - ["components", "features", 31, "components must not add imports from features"],
272 + ["components", "features", 30, "components must not add imports from features"],
273 // native -> features: native glue reading appearance/keyboard/review features.
274 ["native", "features", 8, "native must not add imports from features"],
275 // lib -> state: attachment/session plumbing that predates the cycle
apps/mobile/src/features/threads/CustomSnoozeSheet.android.tsx
+4 -4
@@ -1,4 +1,4 @@
1 -import { MaterialSegmentedButtons } from "../../components/MaterialSegmentedButtons.android";
1 +import { SegmentedControl } from "../../components/SegmentedControl.android";
2 import {
3 BasicAlertDialog,
4 Column,
@@ -141,7 +141,7 @@ export function CustomSnoozeSheet(props: Props) {
141 modifiers={[fillMaxWidth(), padding(24, 24, 24, 16)]}
142 >
143 <Text style={titleTypography}>Custom snooze</Text>
144 - <MaterialSegmentedButtons
144 + <SegmentedControl.Content
145 options={modes}
146 selected={mode}
147 onSelect={(value) => {
@@ -150,7 +150,7 @@ export function CustomSnoozeSheet(props: Props) {
150 }}
151 />
152 {mode === "date" ? (
153 - <MaterialSegmentedButtons
153 + <SegmentedControl.Content
154 options={[
155 {
156 value: "date",
@@ -224,7 +224,7 @@ export function CustomSnoozeSheet(props: Props) {
224 <Text style={titleTypography}>+</Text>
225 </FilledTonalIconButton>
226 </Row>
227 - <MaterialSegmentedButtons options={units} selected={unit} onSelect={setUnit} />
227 + <SegmentedControl.Content options={units} selected={unit} onSelect={setUnit} />
228 </Column>
229 )}
230 <Column
apps/mobile/src/features/workspace/WorkspaceSidebarTabs.ios.tsx
+15 -24
@@ -1,8 +1,6 @@
1 -import { Host, Picker, Text } from "@expo/ui/swift-ui";
2 -import { pickerStyle, tag } from "@expo/ui/swift-ui/modifiers";
1 import { StackActions, useNavigation } from "@react-navigation/native";
2 import { Keyboard, View } from "react-native";
5 -import { useAppearancePreferences } from "../settings/appearance/AppearancePreferencesProvider";
3 +import { SegmentedControl } from "../../components/SegmentedControl";
4 import { useWorkspaceTabs } from "./WorkspaceTabsContext";
5 import type { WorkspaceTab } from "./workspace-tabs-state";
6
@@ -10,29 +8,22 @@ import type { WorkspaceTab } from "./workspace-tabs-state";
8 export function WorkspaceSidebarTabs() {
9 const workspace = useWorkspaceTabs()!;
10 const navigation = useNavigation();
13 - const { themeAppearance } = useAppearancePreferences();
11 return (
12 <View className="px-4 pb-3 pt-2">
16 - <Host
17 - matchContents={{ vertical: true }}
18 - colorScheme={themeAppearance}
19 - style={{ width: "100%" }}
20 - >
21 - <Picker
22 - label="Workspace"
23 - selection={workspace.state.selectedTab}
24 - onSelectionChange={(tab: WorkspaceTab) => {
25 - if (tab === workspace.state.selectedTab) return;
26 - Keyboard.dismiss();
27 - if (navigation.getState()?.index) navigation.dispatch(StackActions.popToTop());
28 - workspace.dispatch({ type: "select", tab });
29 - }}
30 - modifiers={[pickerStyle("segmented")]}
31 - >
32 - <Text modifiers={[tag("threads")]}>Threads</Text>
33 - <Text modifiers={[tag("pullRequests")]}>Pull requests</Text>
34 - </Picker>
35 - </Host>
13 + <SegmentedControl
14 + role="tab"
15 + options={[
16 + { value: "threads", label: "Threads" },
17 + { value: "pullRequests", label: "Pull requests" },
18 + ]}
19 + selected={workspace.state.selectedTab}
20 + onSelect={(tab: WorkspaceTab) => {
21 + if (tab === workspace.state.selectedTab) return;
22 + Keyboard.dismiss();
23 + if (navigation.getState()?.index) navigation.dispatch(StackActions.popToTop());
24 + workspace.dispatch({ type: "select", tab });
25 + }}
26 + />
27 </View>
28 );
29 }
patches/@expo__ui@58.0.11.patch
+166
@@ -128,6 +128,152 @@ index 3e785c1667bcba137c3369da15aa7b397aa0fb37..80dba6ac4dd6ac8caf53fb7839ff3ed3
128 onLayoutContent: onLayoutContent,
129 layoutDirection: layoutDirection ?? (I18nManager.getConstants().isRTL ? 'rightToLeft' : 'leftToRight'),
130 ref: mergedRef
131 +diff --git a/build/swift-ui/Picker/index.d.ts b/build/swift-ui/Picker/index.d.ts
132 +index 5a973529c235050062aedcf749c8ff2d25fd7766..01e095bf179ed0d1642f1c50f2c0604f70f842d5 100644
133 +--- a/build/swift-ui/Picker/index.d.ts
134 ++++ b/build/swift-ui/Picker/index.d.ts
135 +@@ -7,6 +7,15 @@ export type PickerProps<T extends SelectionValueType = any> = {
136 + * For example: 'photo', 'heart.fill', 'star.circle'
137 + */
138 + systemImage?: SFSymbol;
139 ++ /** Native options rendered by a scoped UISegmentedControl. */
140 ++ segments?: { label: string; value: T }[];
141 ++ /** Only used with segments. */
142 ++ segmentColors?: {
143 ++ background?: string;
144 ++ selectedBackground?: string;
145 ++ text?: string;
146 ++ selectedText?: string;
147 ++ };
148 + /**
149 + * A label displayed on the picker.
150 + */
151 +diff --git a/ios/Picker/PickerView.swift b/ios/Picker/PickerView.swift
152 +index 92236438f153f6f05d8fffc8c4057dcf7b968547..2d966f297350183abe28f9c5d778ce10a34bce6e 100644
153 +--- a/ios/Picker/PickerView.swift
154 ++++ b/ios/Picker/PickerView.swift
155 +@@ -1,12 +1,27 @@
156 + // Copyright 2025-present 650 Industries. All rights reserved.
157 +
158 + import SwiftUI
159 ++import UIKit
160 + import ExpoModulesCore
161 +
162 ++internal struct PickerSegment: Record {
163 ++ @Field var label: String = ""
164 ++ @Field var value: Either<String, Double>?
165 ++}
166 ++
167 ++internal struct PickerSegmentColors: Record {
168 ++ @Field var background: Color?
169 ++ @Field var selectedBackground: Color?
170 ++ @Field var text: Color?
171 ++ @Field var selectedText: Color?
172 ++}
173 ++
174 + internal final class PickerProps: UIBaseViewProps {
175 + @Field var label: String?
176 + @Field var systemImage: String?
177 + @Field var selection: Either<String, Double>?
178 ++ @Field var segments: [PickerSegment]?
179 ++ @Field var segmentColors: PickerSegmentColors?
180 + var onSelectionChange = EventDispatcher()
181 + }
182 +
183 +@@ -24,7 +39,18 @@ internal struct PickerView: ExpoSwiftUI.View {
184 +
185 + let labelContent = props.children?.slot("label")
186 +
187 +- if let systemImage = props.systemImage, let label = props.label {
188 ++ if let segments = props.segments {
189 ++ NativeSegmentedPicker(
190 ++ segments: segments,
191 ++ colors: props.segmentColors,
192 ++ selection: Self.getHashableFromEither(props.selection),
193 ++ onSelectionChange: { index in
194 ++ guard segments.indices.contains(index),
195 ++ let value = Self.getHashableFromEither(segments[index].value) else { return }
196 ++ props.onSelectionChange(["selection": value.base])
197 ++ }
198 ++ )
199 ++ } else if let systemImage = props.systemImage, let label = props.label {
200 + Picker(label, systemImage: systemImage, selection: $selection) { content }
201 + } else if let labelContent {
202 + Picker(selection: $selection) { content } label: { labelContent }
203 +@@ -61,7 +87,7 @@ internal struct PickerView: ExpoSwiftUI.View {
204 + }
205 + }
206 +
207 +- private static func getHashableFromEither(_ either: Either<String, Double>?) -> AnyHashable? {
208 ++ fileprivate static func getHashableFromEither(_ either: Either<String, Double>?) -> AnyHashable? {
209 + guard let either else { return nil }
210 + if let stringValue: String = either.get() {
211 + return stringValue
212 +@@ -72,3 +98,64 @@ internal struct PickerView: ExpoSwiftUI.View {
213 + return nil
214 + }
215 + }
216 ++
217 ++
218 ++/// Instance-scoped styling: never changes UISegmentedControl.appearance().
219 ++private struct NativeSegmentedPicker: UIViewRepresentable {
220 ++ let segments: [PickerSegment]
221 ++ let colors: PickerSegmentColors?
222 ++ let selection: AnyHashable?
223 ++ let onSelectionChange: (Int) -> Void
224 ++
225 ++ func makeCoordinator() -> Coordinator {
226 ++ Coordinator(onSelectionChange: onSelectionChange)
227 ++ }
228 ++
229 ++ func makeUIView(context: Context) -> UISegmentedControl {
230 ++ let control = UISegmentedControl()
231 ++ control.addTarget(context.coordinator, action: #selector(Coordinator.changed(_:)), for: .valueChanged)
232 ++ control.setContentHuggingPriority(.defaultLow, for: .horizontal)
233 ++ return control
234 ++ }
235 ++
236 ++ func updateUIView(_ control: UISegmentedControl, context: Context) {
237 ++ context.coordinator.onSelectionChange = onSelectionChange
238 ++ let labels = segments.map(\.label)
239 ++ if context.coordinator.labels != labels {
240 ++ control.removeAllSegments()
241 ++ for (index, label) in labels.enumerated() {
242 ++ control.insertSegment(withTitle: label, at: index, animated: false)
243 ++ }
244 ++ context.coordinator.labels = labels
245 ++ }
246 ++ control.selectedSegmentIndex = segments.firstIndex {
247 ++ PickerView.getHashableFromEither($0.value) == selection
248 ++ } ?? UISegmentedControl.noSegment
249 ++ control.backgroundColor = colors?.background.map { UIColor($0) }
250 ++ control.selectedSegmentTintColor = colors?.selectedBackground.map { UIColor($0) }
251 ++ control.setTitleTextAttributes(
252 ++ colors?.text.map { [.foregroundColor: UIColor($0)] }, for: .normal
253 ++ )
254 ++ control.setTitleTextAttributes(
255 ++ colors?.selectedText.map { [.foregroundColor: UIColor($0)] }, for: .selected
256 ++ )
257 ++ control.isEnabled = context.environment.isEnabled
258 ++ }
259 ++
260 ++ func sizeThatFits(_ proposal: ProposedViewSize, uiView: UISegmentedControl, context: Context) -> CGSize? {
261 ++ CGSize(width: proposal.width ?? uiView.intrinsicContentSize.width, height: uiView.intrinsicContentSize.height)
262 ++ }
263 ++
264 ++ final class Coordinator: NSObject {
265 ++ var labels: [String] = []
266 ++ var onSelectionChange: (Int) -> Void
267 ++
268 ++ init(onSelectionChange: @escaping (Int) -> Void) {
269 ++ self.onSelectionChange = onSelectionChange
270 ++ }
271 ++
272 ++ @objc func changed(_ control: UISegmentedControl) {
273 ++ onSelectionChange(control.selectedSegmentIndex)
274 ++ }
275 ++ }
276 ++}
277 diff --git a/src/jetpack-compose/Host/index.tsx b/src/jetpack-compose/Host/index.tsx
278 index c38eb76691942ee8515776cb443cd3b003052db3..ca3b901fc7c31768cce9d7923070332ac0d79760 100644
279 --- a/src/jetpack-compose/Host/index.tsx
@@ -178,3 +324,23 @@ index c38eb76691942ee8515776cb443cd3b003052db3..ca3b901fc7c31768cce9d7923070332a
324 onLayoutContent={onLayoutContent}
325 layoutDirection={
326 layoutDirection ?? (I18nManager.getConstants().isRTL ? 'rightToLeft' : 'leftToRight')
327 +diff --git a/src/swift-ui/Picker/index.tsx b/src/swift-ui/Picker/index.tsx
328 +index ab7d7ceee94cc5755cdb4b708e70600d12532205..ceac7bff6ca71ed7fbfc526d771123e9e8aabd6e 100644
329 +--- a/src/swift-ui/Picker/index.tsx
330 ++++ b/src/swift-ui/Picker/index.tsx
331 +@@ -13,6 +13,15 @@ export type PickerProps<T extends SelectionValueType = any> = {
332 + * For example: 'photo', 'heart.fill', 'star.circle'
333 + */
334 + systemImage?: SFSymbol;
335 ++ /** Native segmented options. Uses a scoped UISegmentedControl instead of SwiftUI Picker. */
336 ++ segments?: { label: string; value: T }[];
337 ++ /** Colors for the native segmented control. Only used with segments. */
338 ++ segmentColors?: {
339 ++ background?: string;
340 ++ selectedBackground?: string;
341 ++ text?: string;
342 ++ selectedText?: string;
343 ++ };
344 + /**
345 + * A label displayed on the picker.
346 + */
pnpm-lock.yaml
+4 -4
@@ -152,7 +152,7 @@ patchedDependencies:
152 '@clerk/expo@4.6.8': b8b22ab733de5bea846ad9e88046c10582352fe9ad86f314f368b2a823f0f281
153 '@effect/vitest@4.0.5': 2731c9c3761c595f25ddc625a7d61ca376b389d5b3049ecb837c8940f21cfa02
154 '@expo/metro-config@58.0.6': 90fa980e8b6480631fb2fbb04559834e3c612db40c550cd828f11be297d8d760
155 - '@expo/ui@58.0.11': d1efeb3611dec747fce7a526860697187e82ba87b5b75993d115f73e2ef0e1f7
155 + '@expo/ui@58.0.11': 0ec83d194d9463846007dd6a12c1b47f84f3164ea0bc121d720267f15b2eb69a
156 '@ff-labs/fff-node@0.11.0': cc71fcec015f4d39bc96ae2e2bf6b0ca678124c722c66a7841efce9d34b5983c
157 '@legendapp/list@3.3.5': 680cc6a5c5b4a4032e467e7b3fde22f89a84c0ee2e6eac6fda737d6277cc0806
158 '@pierre/diffs@1.5.2': 298e94372dbd51846a4e26ece2ecc3e22eb1f94b0450b1f1a9c6fec127809be7
@@ -323,7 +323,7 @@ importers:
323 version: 58.0.10(@expo/log-box@58.0.8)(expo@58.0.2)(react-dom@19.3.0(react@19.3.0))(react-native@0.88.0-rc.3(@babel/core@7.29.7)(@react-native/metro-config@0.88.0-rc.3(@babel/core@7.29.7)(bufferutil@4.1.0)(utf-8-validate@6.0.6))(@types/react@19.3.0)(bufferutil@4.1.0)(react@19.3.0)(utf-8-validate@6.0.6))(react@19.3.0)
324 '@expo/ui':
325 specifier: 58.0.11
326 - version: 58.0.11(patch_hash=d1efeb3611dec747fce7a526860697187e82ba87b5b75993d115f73e2ef0e1f7)(@babel/core@7.29.7)(expo@58.0.2)(react-dom@19.3.0(react@19.3.0))(react-native-worklets@0.13.0(@babel/core@7.29.7)(@react-native/metro-config@0.88.0-rc.3(@babel/core@7.29.7)(bufferutil@4.1.0)(utf-8-validate@6.0.6))(react-native@0.88.0-rc.3(@babel/core@7.29.7)(@react-native/metro-config@0.88.0-rc.3(@babel/core@7.29.7)(bufferutil@4.1.0)(utf-8-validate@6.0.6))(@types/react@19.3.0)(bufferutil@4.1.0)(react@19.3.0)(utf-8-validate@6.0.6))(react@19.3.0))(react-native@0.88.0-rc.3(@babel/core@7.29.7)(@react-native/metro-config@0.88.0-rc.3(@babel/core@7.29.7)(bufferutil@4.1.0)(utf-8-validate@6.0.6))(@types/react@19.3.0)(bufferutil@4.1.0)(react@19.3.0)(utf-8-validate@6.0.6))(react@19.3.0)
326 + version: 58.0.11(patch_hash=0ec83d194d9463846007dd6a12c1b47f84f3164ea0bc121d720267f15b2eb69a)(@babel/core@7.29.7)(expo@58.0.2)(react-dom@19.3.0(react@19.3.0))(react-native-worklets@0.13.0(@babel/core@7.29.7)(@react-native/metro-config@0.88.0-rc.3(@babel/core@7.29.7)(bufferutil@4.1.0)(utf-8-validate@6.0.6))(react-native@0.88.0-rc.3(@babel/core@7.29.7)(@react-native/metro-config@0.88.0-rc.3(@babel/core@7.29.7)(bufferutil@4.1.0)(utf-8-validate@6.0.6))(@types/react@19.3.0)(bufferutil@4.1.0)(react@19.3.0)(utf-8-validate@6.0.6))(react@19.3.0))(react-native@0.88.0-rc.3(@babel/core@7.29.7)(@react-native/metro-config@0.88.0-rc.3(@babel/core@7.29.7)(bufferutil@4.1.0)(utf-8-validate@6.0.6))(@types/react@19.3.0)(bufferutil@4.1.0)(react@19.3.0)(utf-8-validate@6.0.6))(react@19.3.0)
327 '@legendapp/list':
328 specifier: 'catalog:'
329 version: 3.3.5(patch_hash=680cc6a5c5b4a4032e467e7b3fde22f89a84c0ee2e6eac6fda737d6277cc0806)(react-dom@19.3.0(react@19.3.0))(react-native@0.88.0-rc.3(@babel/core@7.29.7)(@react-native/metro-config@0.88.0-rc.3(@babel/core@7.29.7)(bufferutil@4.1.0)(utf-8-validate@6.0.6))(@types/react@19.3.0)(bufferutil@4.1.0)(react@19.3.0)(utf-8-validate@6.0.6))(react@19.3.0)
@@ -14763,7 +14763,7 @@ snapshots:
14763
14764 '@expo/sudo-prompt@9.3.2': {}
14765
14766 - '@expo/ui@58.0.11(patch_hash=d1efeb3611dec747fce7a526860697187e82ba87b5b75993d115f73e2ef0e1f7)(@babel/core@7.29.7)(expo@58.0.2)(react-dom@19.3.0(react@19.3.0))(react-native-worklets@0.13.0(@babel/core@7.29.7)(@react-native/metro-config@0.88.0-rc.3(@babel/core@7.29.7)(bufferutil@4.1.0)(utf-8-validate@6.0.6))(react-native@0.88.0-rc.3(@babel/core@7.29.7)(@react-native/metro-config@0.88.0-rc.3(@babel/core@7.29.7)(bufferutil@4.1.0)(utf-8-validate@6.0.6))(@types/react@19.3.0)(bufferutil@4.1.0)(react@19.3.0)(utf-8-validate@6.0.6))(react@19.3.0))(react-native@0.88.0-rc.3(@babel/core@7.29.7)(@react-native/metro-config@0.88.0-rc.3(@babel/core@7.29.7)(bufferutil@4.1.0)(utf-8-validate@6.0.6))(@types/react@19.3.0)(bufferutil@4.1.0)(react@19.3.0)(utf-8-validate@6.0.6))(react@19.3.0)':
14766 + '@expo/ui@58.0.11(patch_hash=0ec83d194d9463846007dd6a12c1b47f84f3164ea0bc121d720267f15b2eb69a)(@babel/core@7.29.7)(expo@58.0.2)(react-dom@19.3.0(react@19.3.0))(react-native-worklets@0.13.0(@babel/core@7.29.7)(@react-native/metro-config@0.88.0-rc.3(@babel/core@7.29.7)(bufferutil@4.1.0)(utf-8-validate@6.0.6))(react-native@0.88.0-rc.3(@babel/core@7.29.7)(@react-native/metro-config@0.88.0-rc.3(@babel/core@7.29.7)(bufferutil@4.1.0)(utf-8-validate@6.0.6))(@types/react@19.3.0)(bufferutil@4.1.0)(react@19.3.0)(utf-8-validate@6.0.6))(react@19.3.0))(react-native@0.88.0-rc.3(@babel/core@7.29.7)(@react-native/metro-config@0.88.0-rc.3(@babel/core@7.29.7)(bufferutil@4.1.0)(utf-8-validate@6.0.6))(@types/react@19.3.0)(bufferutil@4.1.0)(react@19.3.0)(utf-8-validate@6.0.6))(react@19.3.0)':
14767 dependencies:
14768 expo: 58.0.2(bd4444e61fed72e958d45f73733b7f54)
14769 react: 19.3.0
@@ -19462,7 +19462,7 @@ snapshots:
19462 expo-widgets@58.0.11(patch_hash=d00838b5b215a4c45f89b8b7d34878d158528756fbcf281bae1cbd6f0752deed)(@babel/core@7.29.7)(expo@58.0.2)(react-dom@19.3.0(react@19.3.0))(react-native-worklets@0.13.0(@babel/core@7.29.7)(@react-native/metro-config@0.88.0-rc.3(@babel/core@7.29.7)(bufferutil@4.1.0)(utf-8-validate@6.0.6))(react-native@0.88.0-rc.3(@babel/core@7.29.7)(@react-native/metro-config@0.88.0-rc.3(@babel/core@7.29.7)(bufferutil@4.1.0)(utf-8-validate@6.0.6))(@types/react@19.3.0)(bufferutil@4.1.0)(react@19.3.0)(utf-8-validate@6.0.6))(react@19.3.0))(react-native@0.88.0-rc.3(@babel/core@7.29.7)(@react-native/metro-config@0.88.0-rc.3(@babel/core@7.29.7)(bufferutil@4.1.0)(utf-8-validate@6.0.6))(@types/react@19.3.0)(bufferutil@4.1.0)(react@19.3.0)(utf-8-validate@6.0.6))(react@19.3.0):
19463 dependencies:
19464 '@expo/plist': 0.10.1
19465 - '@expo/ui': 58.0.11(patch_hash=d1efeb3611dec747fce7a526860697187e82ba87b5b75993d115f73e2ef0e1f7)(@babel/core@7.29.7)(expo@58.0.2)(react-dom@19.3.0(react@19.3.0))(react-native-worklets@0.13.0(@babel/core@7.29.7)(@react-native/metro-config@0.88.0-rc.3(@babel/core@7.29.7)(bufferutil@4.1.0)(utf-8-validate@6.0.6))(react-native@0.88.0-rc.3(@babel/core@7.29.7)(@react-native/metro-config@0.88.0-rc.3(@babel/core@7.29.7)(bufferutil@4.1.0)(utf-8-validate@6.0.6))(@types/react@19.3.0)(bufferutil@4.1.0)(react@19.3.0)(utf-8-validate@6.0.6))(react@19.3.0))(react-native@0.88.0-rc.3(@babel/core@7.29.7)(@react-native/metro-config@0.88.0-rc.3(@babel/core@7.29.7)(bufferutil@4.1.0)(utf-8-validate@6.0.6))(@types/react@19.3.0)(bufferutil@4.1.0)(react@19.3.0)(utf-8-validate@6.0.6))(react@19.3.0)
19465 + '@expo/ui': 58.0.11(patch_hash=0ec83d194d9463846007dd6a12c1b47f84f3164ea0bc121d720267f15b2eb69a)(@babel/core@7.29.7)(expo@58.0.2)(react-dom@19.3.0(react@19.3.0))(react-native-worklets@0.13.0(@babel/core@7.29.7)(@react-native/metro-config@0.88.0-rc.3(@babel/core@7.29.7)(bufferutil@4.1.0)(utf-8-validate@6.0.6))(react-native@0.88.0-rc.3(@babel/core@7.29.7)(@react-native/metro-config@0.88.0-rc.3(@babel/core@7.29.7)(bufferutil@4.1.0)(utf-8-validate@6.0.6))(@types/react@19.3.0)(bufferutil@4.1.0)(react@19.3.0)(utf-8-validate@6.0.6))(react@19.3.0))(react-native@0.88.0-rc.3(@babel/core@7.29.7)(@react-native/metro-config@0.88.0-rc.3(@babel/core@7.29.7)(bufferutil@4.1.0)(utf-8-validate@6.0.6))(@types/react@19.3.0)(bufferutil@4.1.0)(react@19.3.0)(utf-8-validate@6.0.6))(react@19.3.0)
19466 expo: 58.0.2(bd4444e61fed72e958d45f73733b7f54)
19467 react: 19.3.0
19468 react-native: 0.88.0-rc.3(@babel/core@7.29.7)(@react-native/metro-config@0.88.0-rc.3(@babel/core@7.29.7)(bufferutil@4.1.0)(utf-8-validate@6.0.6))(@types/react@19.3.0)(bufferutil@4.1.0)(react@19.3.0)(utf-8-validate@6.0.6)