Overview
TheHapticTab component is a wrapper around React Navigation’s PlatformPressable that adds haptic feedback when pressing tab buttons on iOS devices. It provides subtle tactile feedback to enhance the user experience when switching between tabs.
Import
Props
All props from React Navigation’s
BottomTabBarButtonProps are passed through to the underlying PlatformPressable component.Usage
In Tab Navigator
TheHapticTab component is used as the tabBarButton in the tab navigator configuration. From src/app/(tabs)/_layout.tsx:
Platform Behavior
iOS
On iOS devices, the component triggers a light haptic feedback usingHaptics.impactAsync(Haptics.ImpactFeedbackStyle.Light) when the user presses down on a tab button. This provides subtle tactile feedback that aligns with iOS design patterns.
Android and Web
On Android and web platforms, the component behaves like a standard pressable button without haptic feedback, as these platforms don’t have the same haptic feedback APIs or conventions.Implementation Details
The component wraps the press event and adds haptic feedback before calling the originalonPressIn handler:
Haptic Feedback Styles
The component usesImpactFeedbackStyle.Light, which is the most subtle haptic feedback option. Expo Haptics provides three impact styles:
- Light: Subtle feedback for light interactions (used in HapticTab)
- Medium: Moderate feedback for standard interactions
- Heavy: Strong feedback for significant interactions
Related
- expo-haptics - Expo Haptics API
- React Navigation Bottom Tabs - Tab navigator documentation
- Navigation Guide - NearYou navigation setup