Spaces:
Runtime error
Runtime error
Update app.js
Browse files
app.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
| 1 |
import React, { useRef, useEffect, useState } from "react";
|
| 2 |
import { StyleSheet, View, Button, Alert } from "react-native";
|
| 3 |
import { Camera, useCameraDevices } from "react-native-vision-camera";
|
|
|
|
|
|
|
| 4 |
const App = () => {
|
| 5 |
const [hasPermission, setHasPermission] = useState(false);
|
| 6 |
const [cameraType, setCameraType] = useState("rear"); // Default to rear camera
|
|
@@ -28,7 +30,7 @@ const App = () => {
|
|
| 28 |
// Correct image orientation for the rear camera
|
| 29 |
const fixedImage = await ImageManipulator.manipulateAsync(
|
| 30 |
photo.path,
|
| 31 |
-
[{ flip: cameraType === "rear" ?
|
| 32 |
{ compress: 1, format: ImageManipulator.SaveFormat.JPEG }
|
| 33 |
);
|
| 34 |
|
|
|
|
| 1 |
import React, { useRef, useEffect, useState } from "react";
|
| 2 |
import { StyleSheet, View, Button, Alert } from "react-native";
|
| 3 |
import { Camera, useCameraDevices } from "react-native-vision-camera";
|
| 4 |
+
import * as ImageManipulator from "expo-image-manipulator";
|
| 5 |
+
|
| 6 |
const App = () => {
|
| 7 |
const [hasPermission, setHasPermission] = useState(false);
|
| 8 |
const [cameraType, setCameraType] = useState("rear"); // Default to rear camera
|
|
|
|
| 30 |
// Correct image orientation for the rear camera
|
| 31 |
const fixedImage = await ImageManipulator.manipulateAsync(
|
| 32 |
photo.path,
|
| 33 |
+
[{ flip: cameraType === "rear" ? ImageManipulator.FlipType.Horizontal : undefined }], // Flip only for rear camera
|
| 34 |
{ compress: 1, format: ImageManipulator.SaveFormat.JPEG }
|
| 35 |
);
|
| 36 |
|