eletrotupi / tcc/ frontend/components/misc/haptic-tab.tsx6a9fe5b77720fa5162524137e887503e8f7fdc71
564 B | 18 lines Raw
1
import { BottomTabBarButtonProps } from '@react-navigation/bottom-tabs';
2
import { PlatformPressable } from '@react-navigation/elements';
3
import * as Haptics from 'expo-haptics';
4

5
export function HapticTab(props: BottomTabBarButtonProps) {
6
  return (
7
    <PlatformPressable
8
      {...props}
9
      onPressIn={(ev) => {
10
        if (process.env.EXPO_OS === 'ios') {
11
          // Add a soft haptic feedback when pressing down on the tabs.
12
          Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light);
13
        }
14
        props.onPressIn?.(ev);
15
      }}
16
    />
17
  );
18
}