From b342c9e05db6f4e05e4e7a9a0f2f27bd129bf24b Mon Sep 17 00:00:00 2001 From: Rory Abraham <47436092+roryabraham@users.noreply.github.com> Date: Tue, 17 Sep 2024 12:27:09 -0700 Subject: [PATCH] Merge pull request #49351 from Expensify/revert-48417-@wolewicki/bump-react-native-pdf MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [CP Staging] Revert "[NoQA] feat: bump react-native-pdf to newest version, remove unnecessary pat…" (cherry picked from commit 2df69e5a32baf9c4418788a21b0d5612504adcee) (CP triggered by grgia) --- ios/Podfile.lock | 6 ++-- package-lock.json | 7 ++-- package.json | 2 +- patches/react-native-pdf+6.7.3.patch | 53 ++++++++++++++++++++++++++++ patches/react-native-pdf+6.7.5.patch | 12 ------- 5 files changed, 60 insertions(+), 20 deletions(-) create mode 100644 patches/react-native-pdf+6.7.3.patch delete mode 100644 patches/react-native-pdf+6.7.5.patch diff --git a/ios/Podfile.lock b/ios/Podfile.lock index a8d151d3811..0f1a42791d1 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -1774,7 +1774,7 @@ PODS: - ReactCommon/turbomodule/bridging - ReactCommon/turbomodule/core - Yoga - - react-native-pdf (6.7.5): + - react-native-pdf (6.7.3): - DoubleConversion - glog - hermes-engine @@ -3182,7 +3182,7 @@ SPEC CHECKSUMS: react-native-launch-arguments: 5f41e0abf88a15e3c5309b8875d6fd5ac43df49d react-native-netinfo: fb5112b1fa754975485884ae85a3fb6a684f49d5 react-native-pager-view: 94195f1bf32e7f78359fa20057c97e632364a08b - react-native-pdf: 2e2591ebd39422163850403b1c0cd7d6b351e168 + react-native-pdf: dd6ae39a93607a80919bef9f3499e840c693989d react-native-performance: 3c608307be10964f8a97d3af462f37125b6d8fa5 react-native-plaid-link-sdk: f91a22b45b7c3d4cd6c47273200dc57df35068b0 react-native-quick-sqlite: 7c793c9f5834e756b336257a8d8b8239b7ceb451 @@ -3246,7 +3246,7 @@ SPEC CHECKSUMS: SocketRocket: abac6f5de4d4d62d24e11868d7a2f427e0ef940d Turf: aa2ede4298009639d10db36aba1a7ebaad072a5e VisionCamera: c6c8aa4b028501fc87644550fbc35a537d4da3fb - Yoga: 2a45d7e59592db061217551fd3bbe2dd993817ae + Yoga: a1d7895431387402a674fd0d1c04ec85e87909b8 PODFILE CHECKSUM: e479ec84cb53e5fd463486d71dfee91708d3fd9a diff --git a/package-lock.json b/package-lock.json index ed4cd60fa04..fd05b0aa6af 100644 --- a/package-lock.json +++ b/package-lock.json @@ -97,7 +97,7 @@ "react-native-modal": "^13.0.0", "react-native-onyx": "2.0.68", "react-native-pager-view": "6.4.1", - "react-native-pdf": "6.7.5", + "react-native-pdf": "6.7.3", "react-native-performance": "^5.1.0", "react-native-permissions": "^3.10.0", "react-native-picker-select": "git+https://github.com/Expensify/react-native-picker-select.git#da50d2c5c54e268499047f9cc98b8df4196c1ddf", @@ -36695,9 +36695,8 @@ } }, "node_modules/react-native-pdf": { - "version": "6.7.5", - "resolved": "https://registry.npmjs.org/react-native-pdf/-/react-native-pdf-6.7.5.tgz", - "integrity": "sha512-d1S76p2Vwax2iG+kTnjINiUMvpjtJJvtMiYwHRbgGczT8GJjtXH49YCWOd+HfnUAU29cB+knzsKGYoZBMQM8Ow==", + "version": "6.7.3", + "license": "MIT", "dependencies": { "crypto-js": "4.2.0", "deprecated-react-native-prop-types": "^2.3.0" diff --git a/package.json b/package.json index 0339b02b14a..a1632ceebfd 100644 --- a/package.json +++ b/package.json @@ -154,7 +154,7 @@ "react-native-modal": "^13.0.0", "react-native-onyx": "2.0.68", "react-native-pager-view": "6.4.1", - "react-native-pdf": "6.7.5", + "react-native-pdf": "6.7.3", "react-native-performance": "^5.1.0", "react-native-permissions": "^3.10.0", "react-native-picker-select": "git+https://github.com/Expensify/react-native-picker-select.git#da50d2c5c54e268499047f9cc98b8df4196c1ddf", diff --git a/patches/react-native-pdf+6.7.3.patch b/patches/react-native-pdf+6.7.3.patch new file mode 100644 index 00000000000..0f0f270cefd --- /dev/null +++ b/patches/react-native-pdf+6.7.3.patch @@ -0,0 +1,53 @@ +diff --git a/node_modules/react-native-pdf/react-native-pdf.podspec b/node_modules/react-native-pdf/react-native-pdf.podspec +index fb36140..5d5f19e 100644 +--- a/node_modules/react-native-pdf/react-native-pdf.podspec ++++ b/node_modules/react-native-pdf/react-native-pdf.podspec +@@ -17,24 +17,11 @@ Pod::Spec.new do |s| + s.framework = "PDFKit" + + if fabric_enabled +- folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32' +- +- s.pod_target_xcconfig = { +- 'HEADER_SEARCH_PATHS' => '"$(PODS_ROOT)/boost" "$(PODS_ROOT)/boost-for-react-native" "$(PODS_ROOT)/RCT-Folly"', +- "CLANG_CXX_LANGUAGE_STANDARD" => "c++17", +- } + s.platforms = { ios: '11.0', tvos: '11.0' } +- s.compiler_flags = folly_compiler_flags + ' -DRCT_NEW_ARCH_ENABLED' + s.source_files = 'ios/**/*.{h,m,mm,cpp}' + s.requires_arc = true + +- s.dependency "React" +- s.dependency "React-RCTFabric" +- s.dependency "React-Codegen" +- s.dependency "RCT-Folly" +- s.dependency "RCTRequired" +- s.dependency "RCTTypeSafety" +- s.dependency "ReactCommon/turbomodule/core" ++ install_modules_dependencies(s) + else + s.platform = :ios, '8.0' + s.source_files = 'ios/**/*.{h,m,mm}' +diff --git a/node_modules/react-native-pdf/index.js b/node_modules/react-native-pdf/index.js +index c05de52..bea7af8 100644 +--- a/node_modules/react-native-pdf/index.js ++++ b/node_modules/react-native-pdf/index.js +@@ -367,11 +367,17 @@ export default class Pdf extends Component { + message[4] = message.splice(4).join('|'); + } + if (message[0] === 'loadComplete') { ++ let tableContents; ++ try { ++ tableContents = message[4]&&JSON.parse(message[4]); ++ } catch(e) { ++ tableContents = message[4]; ++ } + this.props.onLoadComplete && this.props.onLoadComplete(Number(message[1]), this.state.path, { + width: Number(message[2]), + height: Number(message[3]), + }, +- message[4]&&JSON.parse(message[4])); ++ tableContents); + } else if (message[0] === 'pageChanged') { + this.props.onPageChanged && this.props.onPageChanged(Number(message[1]), Number(message[2])); + } else if (message[0] === 'error') { diff --git a/patches/react-native-pdf+6.7.5.patch b/patches/react-native-pdf+6.7.5.patch deleted file mode 100644 index 0cdcf4d5b0c..00000000000 --- a/patches/react-native-pdf+6.7.5.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/node_modules/react-native-pdf/fabric/RNPDFPdfNativeComponent.js b/node_modules/react-native-pdf/fabric/RNPDFPdfNativeComponent.js -index 596d796..4e47061 100644 ---- a/node_modules/react-native-pdf/fabric/RNPDFPdfNativeComponent.js -+++ b/node_modules/react-native-pdf/fabric/RNPDFPdfNativeComponent.js -@@ -22,6 +22,7 @@ - enablePaging: ?boolean, - enableRTL: ?boolean, - enableAnnotationRendering: ?boolean, -+ enableDoubleTapZoom: ?boolean, - showsHorizontalScrollIndicator: ?boolean, - showsVerticalScrollIndicator: ?boolean, - enableAntialiasing: ?boolean,