Bluesky app fork with some witchin' additions 💫

add haptics to segmented control (#9398)

authored by samuel.fm and committed by

GitHub f53d5b6f 084f60c8

+4 -1
+4 -1
src/components/forms/SegmentedControl.tsx
··· 9 9 import {type StyleProp, View, type ViewStyle} from 'react-native' 10 10 import Animated, {Easing, LinearTransition} from 'react-native-reanimated' 11 11 12 + import {useHaptics} from '#/lib/haptics' 12 13 import {useNonReactiveCallback} from '#/lib/hooks/useNonReactiveCallback' 13 14 import {atoms as a, native, platform, useTheme} from '#/alf' 14 15 import { ··· 142 143 onPress: onPressProp, 143 144 ...props 144 145 }: {value: string; children: React.ReactNode} & Omit<ButtonProps, 'children'>) { 146 + const playHaptic = useHaptics() 145 147 const [position, setPosition] = useState<{x: number; width: number} | null>( 146 148 null, 147 149 ) ··· 174 176 175 177 const onPress = useCallback( 176 178 (evt: any) => { 179 + playHaptic('Light') 177 180 ctx.onSelectValue(value, position) 178 181 onPressProp?.(evt) 179 182 }, 180 - [ctx, value, position, onPressProp], 183 + [ctx, value, position, onPressProp, playHaptic], 181 184 ) 182 185 183 186 return (