From c62752973b8a8495b5a1a1d7b9b356a0820c54d6 Mon Sep 17 00:00:00 2001 From: ozline Date: Sun, 24 Aug 2025 02:21:25 +0800 Subject: [PATCH] add: support haptic for switch --- components/ui/switch.tsx | 6 ++++++ package.json | 1 + yarn.lock | 12 +++++------- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/components/ui/switch.tsx b/components/ui/switch.tsx index a02161ea..0f083e7c 100644 --- a/components/ui/switch.tsx +++ b/components/ui/switch.tsx @@ -9,6 +9,7 @@ import Animated, { } from 'react-native-reanimated'; import { useColorScheme } from '../../lib/useColorScheme'; import { cn } from '../../lib/utils'; +import * as Haptics from 'expo-haptics'; const SwitchWeb = React.forwardRef( ({ className, ...props }, ref) => ( @@ -74,6 +75,11 @@ const SwitchNative = React.forwardRef { + Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Medium) + } + } >