From e5e77a8ad63257825a1786e6f7d12e746dc2ded4 Mon Sep 17 00:00:00 2001 From: Scott Deeter Date: Mon, 1 Apr 2024 09:09:58 -0700 Subject: [PATCH] Revert "feat: Upgrade VisionCamera to V4" --- ios/Podfile.lock | 4 +- package-lock.json | 15 ++----- package.json | 2 +- .../react-native-vision-camera+2.16.8.patch | 22 ++++++++++ .../NavigationAwareCamera/index.native.js | 1 - .../step/IOURequestStepScan/index.native.js | 43 +++++++++---------- 6 files changed, 49 insertions(+), 38 deletions(-) create mode 100644 patches/react-native-vision-camera+2.16.8.patch diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 24ef0704be25..b2995c35c9bc 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -1415,7 +1415,7 @@ PODS: - SDWebImage/Core (~> 5.17) - SocketRocket (0.6.1) - Turf (2.7.0) - - VisionCamera (4.0.0-beta.11): + - VisionCamera (2.16.8): - React - React-callinvoker - React-Core @@ -1920,7 +1920,7 @@ SPEC CHECKSUMS: SDWebImageWebPCoder: af09429398d99d524cae2fe00f6f0f6e491ed102 SocketRocket: f32cd54efbe0f095c4d7594881e52619cfe80b17 Turf: 13d1a92d969ca0311bbc26e8356cca178ce95da2 - VisionCamera: b6b6f46949eae83b71429c971162af337ef34fa3 + VisionCamera: 0a6794d1974aed5d653d0d0cb900493e2583e35a Yoga: e64aa65de36c0832d04e8c7bd614396c77a80047 PODFILE CHECKSUM: a431c146e1501391834a2f299a74093bac53b530 diff --git a/package-lock.json b/package-lock.json index d6c5edbdd981..4c4e6d1d4844 100644 --- a/package-lock.json +++ b/package-lock.json @@ -114,7 +114,7 @@ "react-native-tab-view": "^3.5.2", "react-native-url-polyfill": "^2.0.0", "react-native-view-shot": "3.8.0", - "react-native-vision-camera": "^4.0.0-beta.11", + "react-native-vision-camera": "2.16.8", "react-native-web": "^0.19.9", "react-native-web-linear-gradient": "^1.1.2", "react-native-web-sound": "^0.1.3", @@ -39769,18 +39769,11 @@ } }, "node_modules/react-native-vision-camera": { - "version": "4.0.0-beta.11", - "resolved": "https://registry.npmjs.org/react-native-vision-camera/-/react-native-vision-camera-4.0.0-beta.11.tgz", - "integrity": "sha512-cKg/nwT0q0H1ivEVG+PQt/QxhFgf/dd7SiMm7bCzlSCmt0T2tXyIdLsuY312iKBB2qasQZOYtzRsoQjipHQkDw==", + "version": "2.16.8", + "license": "MIT", "peerDependencies": { "react": "*", - "react-native": "*", - "react-native-worklets-core": "*" - }, - "peerDependenciesMeta": { - "react-native-worklets-core": { - "optional": true - } + "react-native": "*" } }, "node_modules/react-native-web": { diff --git a/package.json b/package.json index 507c58763b85..e25f8ea95b02 100644 --- a/package.json +++ b/package.json @@ -165,7 +165,7 @@ "react-native-tab-view": "^3.5.2", "react-native-url-polyfill": "^2.0.0", "react-native-view-shot": "3.8.0", - "react-native-vision-camera": "^4.0.0-beta.11", + "react-native-vision-camera": "2.16.8", "react-native-web": "^0.19.9", "react-native-web-linear-gradient": "^1.1.2", "react-native-web-sound": "^0.1.3", diff --git a/patches/react-native-vision-camera+2.16.8.patch b/patches/react-native-vision-camera+2.16.8.patch new file mode 100644 index 000000000000..3afc4573985d --- /dev/null +++ b/patches/react-native-vision-camera+2.16.8.patch @@ -0,0 +1,22 @@ +diff --git a/node_modules/react-native-vision-camera/android/build.gradle b/node_modules/react-native-vision-camera/android/build.gradle +index ddfa243..bafffc3 100644 +--- a/node_modules/react-native-vision-camera/android/build.gradle ++++ b/node_modules/react-native-vision-camera/android/build.gradle +@@ -334,7 +334,7 @@ if (ENABLE_FRAME_PROCESSORS) { + def thirdPartyVersions = new Properties() + thirdPartyVersions.load(new FileInputStream(thirdPartyVersionsFile)) + +- def BOOST_VERSION = thirdPartyVersions["BOOST_VERSION"] ++ def BOOST_VERSION = thirdPartyVersions["BOOST_VERSION"] ?: "1.83.0" + def boost_file = new File(downloadsDir, "boost_${BOOST_VERSION}.tar.gz") + def DOUBLE_CONVERSION_VERSION = thirdPartyVersions["DOUBLE_CONVERSION_VERSION"] + def double_conversion_file = new File(downloadsDir, "double-conversion-${DOUBLE_CONVERSION_VERSION}.tar.gz") +@@ -352,7 +352,7 @@ if (ENABLE_FRAME_PROCESSORS) { + + task downloadBoost(dependsOn: createNativeDepsDirectories, type: Download) { + def transformedVersion = BOOST_VERSION.replace("_", ".") +- def srcUrl = "https://boostorg.jfrog.io/artifactory/main/release/${transformedVersion}/source/boost_${BOOST_VERSION}.tar.gz" ++ def srcUrl = "https://archives.boost.io/release/${transformedVersion}/source/boost_${BOOST_VERSION}.tar.gz" + if (REACT_NATIVE_VERSION < 69) { + srcUrl = "https://github.com/react-native-community/boost-for-react-native/releases/download/v${transformedVersion}-0/boost_${BOOST_VERSION}.tar.gz" + } diff --git a/src/pages/iou/request/step/IOURequestStepScan/NavigationAwareCamera/index.native.js b/src/pages/iou/request/step/IOURequestStepScan/NavigationAwareCamera/index.native.js index 64fa291b2003..65c17d3cb7ab 100644 --- a/src/pages/iou/request/step/IOURequestStepScan/NavigationAwareCamera/index.native.js +++ b/src/pages/iou/request/step/IOURequestStepScan/NavigationAwareCamera/index.native.js @@ -15,7 +15,6 @@ const NavigationAwareCamera = React.forwardRef(({cameraTabIndex, ...props}, ref) return ( { // Store the receipt on the transaction object in Onyx @@ -258,7 +257,7 @@ function IOURequestStepScan({ showCameraAlert(); Log.warn('Error taking photo', error); }); - }, [flash, hasFlash, action, translate, transactionID, updateScanAndNavigate, navigateToConfirmationStep, cameraPermissionStatus]); + }, [flash, action, translate, transactionID, updateScanAndNavigate, navigateToConfirmationStep, cameraPermissionStatus]); // Wait for camera permission status to render if (cameraPermissionStatus == null) { @@ -357,22 +356,20 @@ function IOURequestStepScan({ height={CONST.RECEIPT.SHUTTER_SIZE} /> - {hasFlash && ( - setFlash((prevFlash) => !prevFlash)} - > - - - )} + setFlash((prevFlash) => !prevFlash)} + > + + );