diff --git a/apps/mobile/src/components/ui/SegmentedControl.tsx b/apps/mobile/src/components/ui/SegmentedControl.tsx index 8ebb515884ff..4f7e8e9dc0d9 100644 --- a/apps/mobile/src/components/ui/SegmentedControl.tsx +++ b/apps/mobile/src/components/ui/SegmentedControl.tsx @@ -1,6 +1,5 @@ import { useState } from "react"; import { I18nManager, Platform, Pressable, View } from "react-native"; -import Svg, { Defs, LinearGradient, Rect, Stop } from "react-native-svg"; import Animated, { useAnimatedStyle, useReducedMotion, withTiming } from "react-native-reanimated"; import { AppText } from "./AppText"; @@ -9,13 +8,13 @@ import type { SegmentedControlProps } from "./SegmentedControl.types"; export type { SegmentedControlProps } from "./SegmentedControl.types"; -/** Shared capsule control with native press targets and a raised selection. */ +/** Shared capsule control with native press targets and a flat, themed selection. */ export function SegmentedControl( props: SegmentedControlProps, ) { const { colorScheme, colors } = useControlTheme(); const [layout, setLayout] = useState({ width: 0, height: 0 }); - const { width, height } = layout; + const { width } = layout; const reduceMotion = useReducedMotion(); const selectedIndex = props.options.findIndex((option) => option.value === props.selected); const segmentWidth = props.options.length ? Math.max(0, width - 6) / props.options.length : 0; @@ -34,38 +33,20 @@ export function SegmentedControl( className="flex-row rounded-full p-[3px]" style={{ minHeight, - boxShadow: dark ? "0px 1px 2px #00000062" : "0px 1px 2px #00000014", + backgroundColor: colors[dark ? "--color-screen" : "--color-grouped-card"], }} > - {selectedIndex >= 0 && width > 0 ? ( - - + /> ) : null} {props.options.map((option) => { const selected = option.value === props.selected; @@ -96,71 +77,3 @@ export function SegmentedControl( ); } - -/** Pen's inset well and raised selection use opposite vertical edge lighting. */ -function CapsuleSurface({ - width, - height, - dark, - fillTop, - fillBottom, - edgeColor, - selected = false, -}: { - width: number; - height: number; - dark: boolean; - fillTop: string; - fillBottom: string; - edgeColor: string; - selected?: boolean; -}) { - if (width <= 0 || height <= 0) return null; - const edgeOpacity = selected - ? dark - ? [0.22, 0.02] - : [0.13, 0.01] - : dark - ? [0.02, 0.16] - : [0.27, 0.1]; - return ( - - - - - - - - - - - - - {selected && !dark ? ( - - ) : null} - - - ); -}