Skip to content
TypeScript

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

Julius Marminge791feeb060e8
diff --git a/apps/mobile/package.json b/apps/mobile/package.json
index a6b16e23592..9a6a76ff95d 100644
--- a/apps/mobile/package.json
+++ b/apps/mobile/package.json
@@ -164,7 +164,7 @@
},
"autolinking": {
"buildFromSource": [
- "expo-ui",
+ "@expo/ui",
"expo-notifications",
"react-native-screens",
"react-native-reanimated",
diff --git a/apps/mobile/src/components/MaterialSegmentedButtons.android.tsx b/apps/mobile/src/components/MaterialSegmentedButtons.android.tsx
deleted file mode 100644
index e941fc52eef..00000000000
--- a/apps/mobile/src/components/MaterialSegmentedButtons.android.tsx
+++ /dev/null
@@ -1,37 +0,0 @@
-import { SegmentedButton, SingleChoiceSegmentedButtonRow, Text } from "@expo/ui/jetpack-compose";
-import { defaultMinSize, fillMaxWidth } from "@expo/ui/jetpack-compose/modifiers";
-import { useAppearancePreferences } from "../features/settings/appearance/AppearancePreferencesProvider";
-import { useScaledTextRole } from "../features/settings/appearance/useScaledTextRole";
-import type { SegmentedControlProps } from "./SegmentedControl.types";
-
-/** Compose content shared by screen controls and native dialogs, inside their existing Host. */
-export function MaterialSegmentedButtons<Value extends number | string>(
- props: SegmentedControlProps<Value>,
-) {
- const { themeVariables: colors } = useAppearancePreferences();
- const typography = useScaledTextRole("footnote");
- return (
- <SingleChoiceSegmentedButtonRow modifiers={[fillMaxWidth()]}>
- {props.options.map((option) => (
- <SegmentedButton
- key={String(option.value)}
- selected={option.value === props.selected}
- onClick={() => props.onSelect(option.value)}
- modifiers={[defaultMinSize({ minHeight: 48 })]}
- colors={{
- activeContainerColor: colors["--color-secondary"],
- activeContentColor: colors["--color-secondary-foreground"],
- inactiveContainerColor: "transparent",
- inactiveContentColor: colors["--color-foreground"],
- activeBorderColor: colors["--color-border"],
- inactiveBorderColor: colors["--color-border"],
- }}
- >
- <SegmentedButton.Label>
- <Text style={typography}>{option.label}</Text>
- </SegmentedButton.Label>
- </SegmentedButton>
- ))}
- </SingleChoiceSegmentedButtonRow>
- );
-}
diff --git a/apps/mobile/src/components/MaterialSegmentedControl.android.tsx b/apps/mobile/src/components/MaterialSegmentedControl.android.tsx
deleted file mode 100644
index 76734e14d76..00000000000
--- a/apps/mobile/src/components/MaterialSegmentedControl.android.tsx
+++ /dev/null
@@ -1,40 +0,0 @@
-import { Host } from "@expo/ui/jetpack-compose";
-import { MaterialSegmentedButtons } from "./MaterialSegmentedButtons.android";
-import { View } from "react-native";
-
-import { useAppearancePreferences } from "../features/settings/appearance/AppearancePreferencesProvider";
-import type { SegmentedControlProps } from "./SegmentedControl.types";
-
-export function MaterialSegmentedControl<Value extends number | string>(
- props: SegmentedControlProps<Value>,
-) {
- const { themeAppearance } = useAppearancePreferences();
- return (
- <View className={props.className}>
- <View importantForAccessibility="no-hide-descendants">
- <Host
- matchContents={{ vertical: true }}
- colorScheme={themeAppearance}
- ignoreSafeAreaKeyboardInsets
- style={{ width: "100%" }}
- >
- <MaterialSegmentedButtons {...props} />
- </Host>
- </View>
- <View pointerEvents="none" className="absolute inset-0 flex-row">
- {props.options.map((option) => (
- <View
- key={String(option.value)}
- accessible
- accessibilityRole={props.role ?? "button"}
- accessibilityLabel={option.accessibilityLabel ?? option.label}
- accessibilityState={{ selected: option.value === props.selected }}
- accessibilityActions={[{ name: "activate" }]}
- onAccessibilityAction={() => props.onSelect(option.value)}
- className="flex-1"
- />
- ))}
- </View>
- </View>
- );
-}
diff --git a/apps/mobile/src/components/MaterialSegmentedControl.tsx b/apps/mobile/src/components/MaterialSegmentedControl.tsx
deleted file mode 100644
index 0935da6cd66..00000000000
--- a/apps/mobile/src/components/MaterialSegmentedControl.tsx
+++ /dev/null
@@ -1,7 +0,0 @@
-import type { SegmentedControlProps } from "./SegmentedControl.types";
-
-export function MaterialSegmentedControl<Value extends number | string>(
- _props: SegmentedControlProps<Value>,
-) {
- return null;
-}
diff --git a/apps/mobile/src/components/SegmentedControl.android.tsx b/apps/mobile/src/components/SegmentedControl.android.tsx
new file mode 100644
index 00000000000..64de144dd72
--- /dev/null
+++ b/apps/mobile/src/components/SegmentedControl.android.tsx
@@ -0,0 +1,86 @@
+import {
+ Host,
+ SegmentedButton,
+ SingleChoiceSegmentedButtonRow,
+ Text,
+} from "@expo/ui/jetpack-compose";
+import { defaultMinSize, fillMaxWidth } from "@expo/ui/jetpack-compose/modifiers";
+import { useAppearancePreferences } from "../features/settings/appearance/AppearancePreferencesProvider";
+import { useScaledTextRole } from "../features/settings/appearance/useScaledTextRole";
+import { View } from "react-native";
+
+import { useControlTheme } from "./useControlTheme";
+import type { SegmentedControlProps } from "./SegmentedControl.types";
+
+function HostedSegmentedControl<Value extends number | string>(
+ props: SegmentedControlProps<Value>,
+) {
+ const { colorScheme } = useControlTheme();
+ return (
+ <View className={props.className}>
+ <View importantForAccessibility="no-hide-descendants">
+ <Host
+ matchContents={{ vertical: true }}
+ colorScheme={colorScheme}
+ ignoreSafeAreaKeyboardInsets
+ style={{ width: "100%" }}
+ >
+ <SegmentedControlContent {...props} />
+ </Host>
+ </View>
+ <View pointerEvents="none" className="absolute inset-0 flex-row">
+ {props.options.map((option) => (
+ <View
+ key={String(option.value)}
+ accessible
+ accessibilityRole={props.role ?? "button"}
+ accessibilityLabel={option.accessibilityLabel ?? option.label}
+ accessibilityState={{ selected: option.value === props.selected }}
+ accessibilityActions={[{ name: "activate" }]}
+ onAccessibilityAction={() => props.onSelect(option.value)}
+ className="flex-1"
+ />
+ ))}
+ </View>
+ </View>
+ );
+}
+
+export type { SegmentedControlProps } from "./SegmentedControl.types";
+
+/** Compose content shared by screen controls and native dialogs, inside their existing Host. */
+function SegmentedControlContent<Value extends number | string>(
+ props: SegmentedControlProps<Value>,
+) {
+ const { themeVariables: colors } = useAppearancePreferences();
+ const typography = useScaledTextRole("footnote");
+ return (
+ <SingleChoiceSegmentedButtonRow modifiers={[fillMaxWidth()]}>
+ {props.options.map((option) => (
+ <SegmentedButton
+ key={String(option.value)}
+ selected={option.value === props.selected}
+ onClick={() => props.onSelect(option.value)}
+ modifiers={[defaultMinSize({ minHeight: 48 })]}
+ colors={{
+ activeContainerColor: colors["--color-secondary"],
+ activeContentColor: colors["--color-secondary-foreground"],
+ inactiveContainerColor: "transparent",
+ inactiveContentColor: colors["--color-foreground"],
+ activeBorderColor: colors["--color-border"],
+ inactiveBorderColor: colors["--color-border"],
+ }}
+ >
+ <SegmentedButton.Label>
+ <Text style={typography}>{option.label}</Text>
+ </SegmentedButton.Label>
+ </SegmentedButton>
+ ))}
+ </SingleChoiceSegmentedButtonRow>
+ );
+}
+
+/** Content is for callers already inside an Android native Host. */
+export const SegmentedControl = Object.assign(HostedSegmentedControl, {
+ Content: SegmentedControlContent,
+});
diff --git a/apps/mobile/src/components/SegmentedControl.tsx b/apps/mobile/src/components/SegmentedControl.tsx
index 15b1679f98c..bc555c63914 100644
--- a/apps/mobile/src/components/SegmentedControl.tsx
+++ b/apps/mobile/src/components/SegmentedControl.tsx
@@ -1,89 +1,51 @@
-import { useEffect, useState } from "react";
-import { I18nManager, Platform, Pressable, View } from "react-native";
-import Animated, {
- Easing,
- ReduceMotion,
- useAnimatedStyle,
- useSharedValue,
- withTiming,
-} from "react-native-reanimated";
-import { AppText as Text } from "./AppText";
-import { cn } from "../lib/cn";
-import { MaterialSegmentedControl } from "./MaterialSegmentedControl";
+import { Picker } from "@expo/ui/swift-ui";
+import { View } from "react-native";
+
+import { useControlTheme } from "./useControlTheme";
+import { NativeThemeHost } from "./NativeThemeHost";
import type { SegmentedControlProps } from "./SegmentedControl.types";
export type { SegmentedControlProps } from "./SegmentedControl.types";
-export function SegmentedControl<Value extends number | string>(
+/** Let UIKit own segment sizing, selection, and accessibility through SwiftUI. */
+export function SegmentedControl<Value extends string | number>(
props: SegmentedControlProps<Value>,
) {
- const compact = props.size === "compact";
- const [width, setWidth] = useState(0);
- const index = Math.max(
- 0,
- props.options.findIndex((option) => option.value === props.selected),
- );
- const position = useSharedValue(index);
- useEffect(() => {
- position.set(
- withTiming(index, {
- duration: 200,
- easing: Easing.out(Easing.cubic),
- reduceMotion: ReduceMotion.System,
- }),
- );
- }, [index, position]);
- const indicatorStyle = useAnimatedStyle(() => ({
- transform: [
- {
- translateX:
- ((position.value * width) / props.options.length) * (I18nManager.isRTL ? -1 : 1),
- },
- ],
- }));
- if (Platform.OS === "android") {
- return <MaterialSegmentedControl {...props} />;
- }
+ const { colors } = useControlTheme();
return (
- <View
- accessible={false}
- onLayout={(event) => setWidth(event.nativeEvent.layout.width)}
- className={cn(
- "flex-row overflow-hidden",
- "rounded-full border-continuous bg-card",
- props.className,
- )}
- >
- <Animated.View
- pointerEvents="none"
- className="absolute inset-y-0 rounded-full bg-secondary"
- style={[{ width: `${100 / props.options.length}%`, start: 0 }, indicatorStyle]}
- />
- {props.options.map((option) => {
- const active = option.value === props.selected;
- return (
- <Pressable
+ <View className={props.className}>
+ <View accessibilityElementsHidden>
+ <NativeThemeHost matchContents={{ vertical: true }} style={{ width: "100%" }}>
+ <Picker
+ selection={props.selected}
+ onSelectionChange={props.onSelect}
+ segments={props.options.map((option) => ({
+ label: option.label,
+ value: option.value,
+ }))}
+ segmentColors={{
+ background: colors["--color-card"],
+ selectedBackground: colors["--color-secondary"],
+ text: colors["--color-foreground-muted"],
+ selectedText: colors["--color-secondary-foreground"],
+ }}
+ />
+ </NativeThemeHost>
+ </View>
+ <View pointerEvents="none" className="absolute inset-0 flex-row">
+ {props.options.map((option) => (
+ <View
key={String(option.value)}
- accessibilityRole={Platform.OS === "ios" ? "button" : (props.role ?? "button")}
+ accessible
+ accessibilityRole={props.role ?? "button"}
accessibilityLabel={option.accessibilityLabel ?? option.label}
- accessibilityState={{ selected: active }}
- onPress={() => props.onSelect(option.value)}
- className={cn(
- "flex-1 items-center justify-center rounded-full",
- compact ? "h-9" : "h-11",
- )}
- >
- <Text
- className={cn(
- compact ? "text-xs" : "text-sm",
- active ? "font-t3-medium text-secondary-foreground" : "text-foreground-muted",
- )}
- >
- {option.label}
- </Text>
- </Pressable>
- );
- })}
+ accessibilityState={{ selected: option.value === props.selected }}
+ accessibilityActions={[{ name: "activate" }]}
+ onAccessibilityAction={() => props.onSelect(option.value)}
+ className="flex-1"
+ />
+ ))}
+ </View>
</View>
);
}
diff --git a/apps/mobile/src/components/SegmentedControl.types.ts b/apps/mobile/src/components/SegmentedControl.types.ts
index 921dcdb1cbd..a259429e374 100644
--- a/apps/mobile/src/components/SegmentedControl.types.ts
+++ b/apps/mobile/src/components/SegmentedControl.types.ts
@@ -6,7 +6,7 @@ export interface SegmentedControlProps<Value extends number | string> {
}[];
readonly selected: Value;
readonly onSelect: (value: Value) => void;
- /** Compact sizing applies to the non-Material control. */
+ /** Native controls determine their own sizing. Kept for existing callers. */
readonly size?: "default" | "compact";
/** "tab" for the view switcher; filters stay plain buttons. */
readonly role?: "tab" | "button";
diff --git a/apps/mobile/src/dependency-graph.test.ts b/apps/mobile/src/dependency-graph.test.ts
index 5b148384f7b..17bc96a6bf4 100644
--- a/apps/mobile/src/dependency-graph.test.ts
+++ b/apps/mobile/src/dependency-graph.test.ts
@@ -269,7 +269,7 @@ describe("mobile dependency graph", () => {
["lib", "features", 7, "lib must not add imports from features"],
// components -> features: mostly the appearance preferences provider
// and the layout toolbar bridges.
- ["components", "features", 31, "components must not add imports from features"],
+ ["components", "features", 30, "components must not add imports from features"],
// native -> features: native glue reading appearance/keyboard/review features.
["native", "features", 8, "native must not add imports from features"],
// lib -> state: attachment/session plumbing that predates the cycle
diff --git a/apps/mobile/src/features/threads/CustomSnoozeSheet.android.tsx b/apps/mobile/src/features/threads/CustomSnoozeSheet.android.tsx
index e066c01b43c..43ab455d48b 100644
--- a/apps/mobile/src/features/threads/CustomSnoozeSheet.android.tsx
+++ b/apps/mobile/src/features/threads/CustomSnoozeSheet.android.tsx
@@ -1,4 +1,4 @@
-import { MaterialSegmentedButtons } from "../../components/MaterialSegmentedButtons.android";
+import { SegmentedControl } from "../../components/SegmentedControl.android";
import {
BasicAlertDialog,
Column,
@@ -141,7 +141,7 @@ export function CustomSnoozeSheet(props: Props) {
modifiers={[fillMaxWidth(), padding(24, 24, 24, 16)]}
>
<Text style={titleTypography}>Custom snooze</Text>
- <MaterialSegmentedButtons
+ <SegmentedControl.Content
options={modes}
selected={mode}
onSelect={(value) => {
@@ -150,7 +150,7 @@ export function CustomSnoozeSheet(props: Props) {
}}
/>
{mode === "date" ? (
- <MaterialSegmentedButtons
+ <SegmentedControl.Content
options={[
{
value: "date",
@@ -224,7 +224,7 @@ export function CustomSnoozeSheet(props: Props) {
<Text style={titleTypography}>+</Text>
</FilledTonalIconButton>
</Row>
- <MaterialSegmentedButtons options={units} selected={unit} onSelect={setUnit} />
+ <SegmentedControl.Content options={units} selected={unit} onSelect={setUnit} />
</Column>
)}
<Column
diff --git a/apps/mobile/src/features/workspace/WorkspaceSidebarTabs.ios.tsx b/apps/mobile/src/features/workspace/WorkspaceSidebarTabs.ios.tsx
index 40420272dcc..015bccf327d 100644
--- a/apps/mobile/src/features/workspace/WorkspaceSidebarTabs.ios.tsx
+++ b/apps/mobile/src/features/workspace/WorkspaceSidebarTabs.ios.tsx
@@ -1,8 +1,6 @@
-import { Host, Picker, Text } from "@expo/ui/swift-ui";
-import { pickerStyle, tag } from "@expo/ui/swift-ui/modifiers";
import { StackActions, useNavigation } from "@react-navigation/native";
import { Keyboard, View } from "react-native";
-import { useAppearancePreferences } from "../settings/appearance/AppearancePreferencesProvider";
+import { SegmentedControl } from "../../components/SegmentedControl";
import { useWorkspaceTabs } from "./WorkspaceTabsContext";
import type { WorkspaceTab } from "./workspace-tabs-state";
@@ -10,29 +8,22 @@ import type { WorkspaceTab } from "./workspace-tabs-state";
export function WorkspaceSidebarTabs() {
const workspace = useWorkspaceTabs()!;
const navigation = useNavigation();
- const { themeAppearance } = useAppearancePreferences();
return (
<View className="px-4 pb-3 pt-2">
- <Host
- matchContents={{ vertical: true }}
- colorScheme={themeAppearance}
- style={{ width: "100%" }}
- >
- <Picker
- label="Workspace"
- selection={workspace.state.selectedTab}
- onSelectionChange={(tab: WorkspaceTab) => {
- if (tab === workspace.state.selectedTab) return;
- Keyboard.dismiss();
- if (navigation.getState()?.index) navigation.dispatch(StackActions.popToTop());
- workspace.dispatch({ type: "select", tab });
- }}
- modifiers={[pickerStyle("segmented")]}
- >
- <Text modifiers={[tag("threads")]}>Threads</Text>
- <Text modifiers={[tag("pullRequests")]}>Pull requests</Text>
- </Picker>
- </Host>
+ <SegmentedControl
+ role="tab"
+ options={[
+ { value: "threads", label: "Threads" },
+ { value: "pullRequests", label: "Pull requests" },
+ ]}
+ selected={workspace.state.selectedTab}
+ onSelect={(tab: WorkspaceTab) => {
+ if (tab === workspace.state.selectedTab) return;
+ Keyboard.dismiss();
+ if (navigation.getState()?.index) navigation.dispatch(StackActions.popToTop());
+ workspace.dispatch({ type: "select", tab });
+ }}
+ />
</View>
);
}
diff --git a/patches/@[email protected] b/patches/@[email protected]
index 7d05496e32c..bf14704180e 100644
--- a/patches/@[email protected]
+++ b/patches/@[email protected]
@@ -128,6 +128,152 @@ index 3e785c1667bcba137c3369da15aa7b397aa0fb37..80dba6ac4dd6ac8caf53fb7839ff3ed3
onLayoutContent: onLayoutContent,
layoutDirection: layoutDirection ?? (I18nManager.getConstants().isRTL ? 'rightToLeft' : 'leftToRight'),
ref: mergedRef
+diff --git a/build/swift-ui/Picker/index.d.ts b/build/swift-ui/Picker/index.d.ts
+index 5a973529c235050062aedcf749c8ff2d25fd7766..01e095bf179ed0d1642f1c50f2c0604f70f842d5 100644
+--- a/build/swift-ui/Picker/index.d.ts
++++ b/build/swift-ui/Picker/index.d.ts
+@@ -7,6 +7,15 @@ export type PickerProps<T extends SelectionValueType = any> = {
+ * For example: 'photo', 'heart.fill', 'star.circle'
+ */
+ systemImage?: SFSymbol;
++ /** Native options rendered by a scoped UISegmentedControl. */
++ segments?: { label: string; value: T }[];
++ /** Only used with segments. */
++ segmentColors?: {
++ background?: string;
++ selectedBackground?: string;
++ text?: string;
++ selectedText?: string;
++ };
+ /**
+ * A label displayed on the picker.
+ */
+diff --git a/ios/Picker/PickerView.swift b/ios/Picker/PickerView.swift
+index 92236438f153f6f05d8fffc8c4057dcf7b968547..2d966f297350183abe28f9c5d778ce10a34bce6e 100644
+--- a/ios/Picker/PickerView.swift
++++ b/ios/Picker/PickerView.swift
+@@ -1,12 +1,27 @@
+ // Copyright 2025-present 650 Industries. All rights reserved.
+
+ import SwiftUI
++import UIKit
+ import ExpoModulesCore
+
++internal struct PickerSegment: Record {
++ @Field var label: String = ""
++ @Field var value: Either<String, Double>?
++}
++
++internal struct PickerSegmentColors: Record {
++ @Field var background: Color?
++ @Field var selectedBackground: Color?
++ @Field var text: Color?
++ @Field var selectedText: Color?
++}
++
+ internal final class PickerProps: UIBaseViewProps {
+ @Field var label: String?
+ @Field var systemImage: String?
+ @Field var selection: Either<String, Double>?
++ @Field var segments: [PickerSegment]?
++ @Field var segmentColors: PickerSegmentColors?
+ var onSelectionChange = EventDispatcher()
+ }
+
+@@ -24,7 +39,18 @@ internal struct PickerView: ExpoSwiftUI.View {
+
+ let labelContent = props.children?.slot("label")
+
+- if let systemImage = props.systemImage, let label = props.label {
++ if let segments = props.segments {
++ NativeSegmentedPicker(
++ segments: segments,
++ colors: props.segmentColors,
++ selection: Self.getHashableFromEither(props.selection),
++ onSelectionChange: { index in
++ guard segments.indices.contains(index),
++ let value = Self.getHashableFromEither(segments[index].value) else { return }
++ props.onSelectionChange(["selection": value.base])
++ }
++ )
++ } else if let systemImage = props.systemImage, let label = props.label {
+ Picker(label, systemImage: systemImage, selection: $selection) { content }
+ } else if let labelContent {
+ Picker(selection: $selection) { content } label: { labelContent }
+@@ -61,7 +87,7 @@ internal struct PickerView: ExpoSwiftUI.View {
+ }
+ }
+
+- private static func getHashableFromEither(_ either: Either<String, Double>?) -> AnyHashable? {
++ fileprivate static func getHashableFromEither(_ either: Either<String, Double>?) -> AnyHashable? {
+ guard let either else { return nil }
+ if let stringValue: String = either.get() {
+ return stringValue
+@@ -72,3 +98,64 @@ internal struct PickerView: ExpoSwiftUI.View {
+ return nil
+ }
+ }
++
++
++/// Instance-scoped styling: never changes UISegmentedControl.appearance().
++private struct NativeSegmentedPicker: UIViewRepresentable {
++ let segments: [PickerSegment]
++ let colors: PickerSegmentColors?
++ let selection: AnyHashable?
++ let onSelectionChange: (Int) -> Void
++
++ func makeCoordinator() -> Coordinator {
++ Coordinator(onSelectionChange: onSelectionChange)
++ }
++
++ func makeUIView(context: Context) -> UISegmentedControl {
++ let control = UISegmentedControl()
++ control.addTarget(context.coordinator, action: #selector(Coordinator.changed(_:)), for: .valueChanged)
++ control.setContentHuggingPriority(.defaultLow, for: .horizontal)
++ return control
++ }
++
++ func updateUIView(_ control: UISegmentedControl, context: Context) {
++ context.coordinator.onSelectionChange = onSelectionChange
++ let labels = segments.map(\.label)
++ if context.coordinator.labels != labels {
++ control.removeAllSegments()
++ for (index, label) in labels.enumerated() {
++ control.insertSegment(withTitle: label, at: index, animated: false)
++ }
++ context.coordinator.labels = labels
++ }
++ control.selectedSegmentIndex = segments.firstIndex {
++ PickerView.getHashableFromEither($0.value) == selection
++ } ?? UISegmentedControl.noSegment
++ control.backgroundColor = colors?.background.map { UIColor($0) }
++ control.selectedSegmentTintColor = colors?.selectedBackground.map { UIColor($0) }
++ control.setTitleTextAttributes(
++ colors?.text.map { [.foregroundColor: UIColor($0)] }, for: .normal
++ )
++ control.setTitleTextAttributes(
++ colors?.selectedText.map { [.foregroundColor: UIColor($0)] }, for: .selected
++ )
++ control.isEnabled = context.environment.isEnabled
++ }
++
++ func sizeThatFits(_ proposal: ProposedViewSize, uiView: UISegmentedControl, context: Context) -> CGSize? {
++ CGSize(width: proposal.width ?? uiView.intrinsicContentSize.width, height: uiView.intrinsicContentSize.height)
++ }
++
++ final class Coordinator: NSObject {
++ var labels: [String] = []
++ var onSelectionChange: (Int) -> Void
++
++ init(onSelectionChange: @escaping (Int) -> Void) {
++ self.onSelectionChange = onSelectionChange
++ }
++
++ @objc func changed(_ control: UISegmentedControl) {
++ onSelectionChange(control.selectedSegmentIndex)
++ }
++ }
++}
diff --git a/src/jetpack-compose/Host/index.tsx b/src/jetpack-compose/Host/index.tsx
index c38eb76691942ee8515776cb443cd3b003052db3..ca3b901fc7c31768cce9d7923070332ac0d79760 100644
--- a/src/jetpack-compose/Host/index.tsx
@@ -178,3 +324,23 @@ index c38eb76691942ee8515776cb443cd3b003052db3..ca3b901fc7c31768cce9d7923070332a
onLayoutContent={onLayoutContent}
layoutDirection={
layoutDirection ?? (I18nManager.getConstants().isRTL ? 'rightToLeft' : 'leftToRight')
+diff --git a/src/swift-ui/Picker/index.tsx b/src/swift-ui/Picker/index.tsx
+index ab7d7ceee94cc5755cdb4b708e70600d12532205..ceac7bff6ca71ed7fbfc526d771123e9e8aabd6e 100644
+--- a/src/swift-ui/Picker/index.tsx
++++ b/src/swift-ui/Picker/index.tsx
+@@ -13,6 +13,15 @@ export type PickerProps<T extends SelectionValueType = any> = {
+ * For example: 'photo', 'heart.fill', 'star.circle'
+ */
+ systemImage?: SFSymbol;
++ /** Native segmented options. Uses a scoped UISegmentedControl instead of SwiftUI Picker. */
++ segments?: { label: string; value: T }[];
++ /** Colors for the native segmented control. Only used with segments. */
++ segmentColors?: {
++ background?: string;
++ selectedBackground?: string;
++ text?: string;
++ selectedText?: string;
++ };
+ /**
+ * A label displayed on the picker.
+ */
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 7928a04d9d0..1cf6dd571c5 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -152,7 +152,7 @@ patchedDependencies:
'@clerk/[email protected]': b8b22ab733de5bea846ad9e88046c10582352fe9ad86f314f368b2a823f0f281
'@effect/[email protected]': 2731c9c3761c595f25ddc625a7d61ca376b389d5b3049ecb837c8940f21cfa02
'@expo/[email protected]': 90fa980e8b6480631fb2fbb04559834e3c612db40c550cd828f11be297d8d760
- '@expo/[email protected]': d1efeb3611dec747fce7a526860697187e82ba87b5b75993d115f73e2ef0e1f7
+ '@expo/[email protected]': 0ec83d194d9463846007dd6a12c1b47f84f3164ea0bc121d720267f15b2eb69a
'@ff-labs/[email protected]': cc71fcec015f4d39bc96ae2e2bf6b0ca678124c722c66a7841efce9d34b5983c
'@legendapp/[email protected]': 680cc6a5c5b4a4032e467e7b3fde22f89a84c0ee2e6eac6fda737d6277cc0806
'@pierre/[email protected]': 298e94372dbd51846a4e26ece2ecc3e22eb1f94b0450b1f1a9c6fec127809be7
@@ -323,7 +323,7 @@ importers:
'@expo/ui':
specifier: 58.0.11
'@legendapp/list':
specifier: 'catalog:'
@@ -14763,7 +14763,7 @@ snapshots:
'@expo/[email protected]': {}
dependencies:
expo: 58.0.2(bd4444e61fed72e958d45f73733b7f54)
react: 19.3.0
@@ -19462,7 +19462,7 @@ snapshots:
dependencies:
'@expo/plist': 0.10.1
expo: 58.0.2(bd4444e61fed72e958d45f73733b7f54)
react: 19.3.0