eletrotupi / tcc/ frontend/components/misc/haptic-tab.tsx269c1050a0fedbfadc33cb251e67d54cdc399f8f
596 B | 21 lines Raw
1
import { BottomTabBarButtonProps } from 'expo-router/js-tabs';
2
import { Platform, Pressable } from 'react-native';
3
import type { Ref } from 'react';
4
import type { View } from 'react-native';
5
import * as Haptics from 'expo-haptics';
6

7
export function HapticTab(props: BottomTabBarButtonProps) {
8
  const { ref, onPressIn, ...rest } = props;
9
  return (
10
    <Pressable
11
      {...rest}
12
      ref={ref as Ref<View>}
13
      onPressIn={(ev) => {
14
        if (Platform.OS === "ios") {
15
          Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light);
16
        }
17
        onPressIn?.(ev);
18
      }}
19
    />
20
  );
21
}