diff options
author | polwex <polwex@sortug.com> | 2025-07-15 17:20:58 +0700 |
---|---|---|
committer | polwex <polwex@sortug.com> | 2025-07-15 17:20:58 +0700 |
commit | a528bd94a6e8e25010ae26a305550b211df0ddc6 (patch) | |
tree | 887425ddc3160ae023292dfefc49d77c2eb8dcec /components/HapticTab.tsx |
Initial commit
Generated by create-expo 3.4.3.
Diffstat (limited to 'components/HapticTab.tsx')
-rw-r--r-- | components/HapticTab.tsx | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/components/HapticTab.tsx b/components/HapticTab.tsx new file mode 100644 index 0000000..7f3981c --- /dev/null +++ b/components/HapticTab.tsx @@ -0,0 +1,18 @@ +import { BottomTabBarButtonProps } from '@react-navigation/bottom-tabs'; +import { PlatformPressable } from '@react-navigation/elements'; +import * as Haptics from 'expo-haptics'; + +export function HapticTab(props: BottomTabBarButtonProps) { + return ( + <PlatformPressable + {...props} + onPressIn={(ev) => { + if (process.env.EXPO_OS === 'ios') { + // Add a soft haptic feedback when pressing down on the tabs. + Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light); + } + props.onPressIn?.(ev); + }} + /> + ); +} |