feat: haptic feedback

This commit is contained in:
Adrian Castro
2024-02-22 18:30:58 +01:00
parent 16ed0f8a6a
commit 23cfcb8b1a
2 changed files with 6 additions and 0 deletions

View File

@@ -1,5 +1,6 @@
import { useRef } from "react"; import { useRef } from "react";
import { Platform, View } from "react-native"; import { Platform, View } from "react-native";
import * as Haptics from "expo-haptics";
import { Tabs } from "expo-router"; import { Tabs } from "expo-router";
import Colors from "@movie-web/tailwind-config/colors"; import Colors from "@movie-web/tailwind-config/colors";
@@ -21,6 +22,9 @@ export default function TabLayout() {
}} }}
screenListeners={({ route }) => ({ screenListeners={({ route }) => ({
tabPress: () => { tabPress: () => {
void Haptics.notificationAsync(
Haptics.NotificationFeedbackType.Success,
);
switch (route.name) { switch (route.name) {
case "search": case "search":
focusSearchInputRef.current(); focusSearchInputRef.current();

View File

@@ -10,6 +10,7 @@ import {
import { Gesture, GestureDetector } from "react-native-gesture-handler"; import { Gesture, GestureDetector } from "react-native-gesture-handler";
import { runOnJS, useSharedValue } from "react-native-reanimated"; import { runOnJS, useSharedValue } from "react-native-reanimated";
import { ResizeMode, Video } from "expo-av"; import { ResizeMode, Video } from "expo-av";
import * as Haptics from "expo-haptics";
import * as NavigationBar from "expo-navigation-bar"; import * as NavigationBar from "expo-navigation-bar";
import { useRouter } from "expo-router"; import { useRouter } from "expo-router";
import * as StatusBar from "expo-status-bar"; import * as StatusBar from "expo-status-bar";
@@ -58,6 +59,7 @@ export const VideoPlayer = () => {
const updateResizeMode = (newMode: ResizeMode) => { const updateResizeMode = (newMode: ResizeMode) => {
setResizeMode(newMode); setResizeMode(newMode);
void Haptics.notificationAsync(Haptics.NotificationFeedbackType.Success);
}; };
const pinchGesture = Gesture.Pinch().onUpdate((e) => { const pinchGesture = Gesture.Pinch().onUpdate((e) => {