diff --git a/client/package.json b/client/package.json index 83df71b..817fabf 100644 --- a/client/package.json +++ b/client/package.json @@ -24,8 +24,10 @@ "class-variance-authority": "^0.7.1", "expo": "53.0.12", "expo-blur": "~14.1.5", + "expo-camera": "~16.1.10", "expo-constants": "~17.1.6", "expo-dev-client": "~5.2.1", + "expo-file-system": "~18.1.11", "expo-gradle-ext-vars": "^0.1.3", "expo-haptics": "~14.1.4", "expo-linking": "~7.1.5", diff --git a/client/src/components/overlays/camera.tsx b/client/src/components/overlays/camera.tsx new file mode 100644 index 0000000..75fd738 --- /dev/null +++ b/client/src/components/overlays/camera.tsx @@ -0,0 +1,165 @@ +import { IconContainer } from "@/components/ui/icons/icon-container"; +import { Icons } from "@/components/ui/icons/icons"; +import { BlurView } from "expo-blur"; +import React, { useEffect } from "react"; +import { + Pressable, + View, + ScrollView as ScrollViewType, + Platform, + KeyboardAvoidingView, + StyleSheet, +} from "react-native"; +import Animated, { + useAnimatedStyle, + useSharedValue, + withTiming, +} from "react-native-reanimated"; +import { twMerge } from "tailwind-merge"; +import { Button } from "../ui/button"; +import { logger } from "@/shared/instances/logger.instance"; +import { useCamera } from "@/shared/hooks/useCamera"; +import { CameraView } from "expo-camera"; + +interface CameraOverlayProps { + visible?: boolean; + onClose: () => void; + onSucces: () => void; +} + +export const CameraOverlay = ({ + visible, + onClose, + onSucces, +}: CameraOverlayProps) => { + const { + cameraRef, + permission, + requestPermission, + facing, + toggleFacing, + takePhoto, + } = useCamera(); + + const opacity = useSharedValue(0); + + useEffect(() => { + if (visible) { + opacity.value = withTiming(1, { duration: 300 }); + } else { + opacity.value = withTiming(0, { duration: 300 }); + } + }, [visible]); + + const animatedStyle = useAnimatedStyle(() => ({ + opacity: opacity.value, + })); + + if (!permission) { + return ; + } + return ( + + + + + + + {!permission.granted && ( +