@amafil/react-native-pdf-toolkit 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (202) hide show
  1. package/DoubleTapView.js +125 -0
  2. package/LICENSE +21 -0
  3. package/PdfManager.js +26 -0
  4. package/PdfPageView.js +53 -0
  5. package/PdfView.js +421 -0
  6. package/PdfViewFlatList.js +30 -0
  7. package/PinchZoomView.js +125 -0
  8. package/README.md +450 -0
  9. package/android/.gradle/8.5/checksums/checksums.lock +0 -0
  10. package/android/.gradle/8.5/checksums/md5-checksums.bin +0 -0
  11. package/android/.gradle/8.5/checksums/sha1-checksums.bin +0 -0
  12. package/android/.gradle/8.5/dependencies-accessors/dependencies-accessors.lock +0 -0
  13. package/android/.gradle/8.5/dependencies-accessors/gc.properties +0 -0
  14. package/android/.gradle/8.5/executionHistory/executionHistory.bin +0 -0
  15. package/android/.gradle/8.5/executionHistory/executionHistory.lock +0 -0
  16. package/android/.gradle/8.5/fileChanges/last-build.bin +0 -0
  17. package/android/.gradle/8.5/fileHashes/fileHashes.bin +0 -0
  18. package/android/.gradle/8.5/fileHashes/fileHashes.lock +0 -0
  19. package/android/.gradle/8.5/fileHashes/resourceHashesCache.bin +0 -0
  20. package/android/.gradle/8.5/gc.properties +0 -0
  21. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  22. package/android/.gradle/buildOutputCleanup/cache.properties +2 -0
  23. package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
  24. package/android/.gradle/config.properties +2 -0
  25. package/android/.gradle/file-system.probe +0 -0
  26. package/android/.gradle/vcs-1/gc.properties +0 -0
  27. package/android/.idea/AndroidProjectSystem.xml +6 -0
  28. package/android/.idea/caches/deviceStreaming.xml +1414 -0
  29. package/android/.idea/compiler.xml +6 -0
  30. package/android/.idea/deviceManager.xml +13 -0
  31. package/android/.idea/gradle.xml +17 -0
  32. package/android/.idea/migrations.xml +10 -0
  33. package/android/.idea/misc.xml +10 -0
  34. package/android/.idea/runConfigurations.xml +17 -0
  35. package/android/.idea/vcs.xml +6 -0
  36. package/android/build/.transforms/3337b950908a4f6985ba400cb8386b0b/results.bin +1 -0
  37. package/android/build/.transforms/3337b950908a4f6985ba400cb8386b0b/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/facebook/react/viewmanagers/RNPDFPdfViewManagerDelegate.dex +0 -0
  38. package/android/build/.transforms/3337b950908a4f6985ba400cb8386b0b/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/facebook/react/viewmanagers/RNPDFPdfViewManagerInterface.dex +0 -0
  39. package/android/build/.transforms/3337b950908a4f6985ba400cb8386b0b/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/org/wonday/pdf/BuildConfig.dex +0 -0
  40. package/android/build/.transforms/3337b950908a4f6985ba400cb8386b0b/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/org/wonday/pdf/PdfManager.dex +0 -0
  41. package/android/build/.transforms/3337b950908a4f6985ba400cb8386b0b/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/org/wonday/pdf/PdfView$1.dex +0 -0
  42. package/android/build/.transforms/3337b950908a4f6985ba400cb8386b0b/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/org/wonday/pdf/PdfView$2.dex +0 -0
  43. package/android/build/.transforms/3337b950908a4f6985ba400cb8386b0b/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/org/wonday/pdf/PdfView$3.dex +0 -0
  44. package/android/build/.transforms/3337b950908a4f6985ba400cb8386b0b/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/org/wonday/pdf/PdfView.dex +0 -0
  45. package/android/build/.transforms/3337b950908a4f6985ba400cb8386b0b/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/org/wonday/pdf/RNPDFPackage.dex +0 -0
  46. package/android/build/.transforms/3337b950908a4f6985ba400cb8386b0b/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/org/wonday/pdf/events/TopChangeEvent.dex +0 -0
  47. package/android/build/.transforms/3337b950908a4f6985ba400cb8386b0b/transformed/bundleLibRuntimeToDirDebug/desugar_graph.bin +0 -0
  48. package/android/build/.transforms/787b9137f14dcc9eebbb21ac62a7be22/results.bin +1 -0
  49. package/android/build/.transforms/787b9137f14dcc9eebbb21ac62a7be22/transformed/classes/classes_dex/classes.dex +0 -0
  50. package/android/build/.transforms/79ca1220a602ed0c9c23366e0e92a6d1/results.bin +1 -0
  51. package/android/build/.transforms/79ca1220a602ed0c9c23366e0e92a6d1/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/facebook/react/viewmanagers/RNPDFPdfViewManagerDelegate.dex +0 -0
  52. package/android/build/.transforms/79ca1220a602ed0c9c23366e0e92a6d1/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/facebook/react/viewmanagers/RNPDFPdfViewManagerInterface.dex +0 -0
  53. package/android/build/.transforms/79ca1220a602ed0c9c23366e0e92a6d1/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/org/wonday/pdf/BuildConfig.dex +0 -0
  54. package/android/build/.transforms/79ca1220a602ed0c9c23366e0e92a6d1/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/org/wonday/pdf/PdfManager.dex +0 -0
  55. package/android/build/.transforms/79ca1220a602ed0c9c23366e0e92a6d1/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/org/wonday/pdf/PdfView$1.dex +0 -0
  56. package/android/build/.transforms/79ca1220a602ed0c9c23366e0e92a6d1/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/org/wonday/pdf/PdfView$2.dex +0 -0
  57. package/android/build/.transforms/79ca1220a602ed0c9c23366e0e92a6d1/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/org/wonday/pdf/PdfView$3.dex +0 -0
  58. package/android/build/.transforms/79ca1220a602ed0c9c23366e0e92a6d1/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/org/wonday/pdf/PdfView.dex +0 -0
  59. package/android/build/.transforms/79ca1220a602ed0c9c23366e0e92a6d1/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/org/wonday/pdf/RNPDFPackage.dex +0 -0
  60. package/android/build/.transforms/79ca1220a602ed0c9c23366e0e92a6d1/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/org/wonday/pdf/events/TopChangeEvent.dex +0 -0
  61. package/android/build/.transforms/79ca1220a602ed0c9c23366e0e92a6d1/transformed/bundleLibRuntimeToDirDebug/desugar_graph.bin +0 -0
  62. package/android/build/.transforms/c29f40a753b0ae1d85db8c8c5812fc85/results.bin +1 -0
  63. package/android/build/.transforms/c29f40a753b0ae1d85db8c8c5812fc85/transformed/classes/classes_dex/classes.dex +0 -0
  64. package/android/build/generated/source/buildConfig/debug/org/wonday/pdf/BuildConfig.java +12 -0
  65. package/android/build/generated/source/codegen/java/com/facebook/react/viewmanagers/RNPDFPdfViewManagerDelegate.java +99 -0
  66. package/android/build/generated/source/codegen/java/com/facebook/react/viewmanagers/RNPDFPdfViewManagerInterface.java +38 -0
  67. package/android/build/generated/source/codegen/jni/CMakeLists.txt +28 -0
  68. package/android/build/generated/source/codegen/jni/react/renderer/components/rnpdf/ComponentDescriptors.cpp +22 -0
  69. package/android/build/generated/source/codegen/jni/react/renderer/components/rnpdf/ComponentDescriptors.h +24 -0
  70. package/android/build/generated/source/codegen/jni/react/renderer/components/rnpdf/EventEmitters.cpp +24 -0
  71. package/android/build/generated/source/codegen/jni/react/renderer/components/rnpdf/EventEmitters.h +25 -0
  72. package/android/build/generated/source/codegen/jni/react/renderer/components/rnpdf/Props.cpp +132 -0
  73. package/android/build/generated/source/codegen/jni/react/renderer/components/rnpdf/Props.h +50 -0
  74. package/android/build/generated/source/codegen/jni/react/renderer/components/rnpdf/ShadowNodes.cpp +17 -0
  75. package/android/build/generated/source/codegen/jni/react/renderer/components/rnpdf/ShadowNodes.h +32 -0
  76. package/android/build/generated/source/codegen/jni/react/renderer/components/rnpdf/States.cpp +16 -0
  77. package/android/build/generated/source/codegen/jni/react/renderer/components/rnpdf/States.h +20 -0
  78. package/android/build/generated/source/codegen/jni/react/renderer/components/rnpdf/rnpdfJSI-generated.cpp +17 -0
  79. package/android/build/generated/source/codegen/jni/react/renderer/components/rnpdf/rnpdfJSI.h +19 -0
  80. package/android/build/generated/source/codegen/jni/rnpdf-generated.cpp +22 -0
  81. package/android/build/generated/source/codegen/jni/rnpdf.h +24 -0
  82. package/android/build/generated/source/codegen/schema.json +1 -0
  83. package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/AndroidManifest.xml +7 -0
  84. package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/output-metadata.json +18 -0
  85. package/android/build/intermediates/aapt_friendly_merged_manifests/debug/processDebugManifest/aapt/AndroidManifest.xml +7 -0
  86. package/android/build/intermediates/aapt_friendly_merged_manifests/debug/processDebugManifest/aapt/output-metadata.json +18 -0
  87. package/android/build/intermediates/aar_main_jar/debug/syncDebugLibJars/classes.jar +0 -0
  88. package/android/build/intermediates/aar_metadata/debug/aar-metadata.properties +5 -0
  89. package/android/build/intermediates/aar_metadata/debug/writeDebugAarMetadata/aar-metadata.properties +6 -0
  90. package/android/build/intermediates/annotation_processor_list/debug/annotationProcessors.json +1 -0
  91. package/android/build/intermediates/annotation_processor_list/debug/javaPreCompileDebug/annotationProcessors.json +1 -0
  92. package/android/build/intermediates/annotation_processor_list/debugAndroidTest/annotationProcessors.json +1 -0
  93. package/android/build/intermediates/annotation_processor_list/debugUnitTest/annotationProcessors.json +1 -0
  94. package/android/build/intermediates/annotations_typedef_file/debug/extractDebugAnnotations/typedefs.txt +0 -0
  95. package/android/build/intermediates/compile_library_classes_jar/debug/bundleLibCompileToJarDebug/classes.jar +0 -0
  96. package/android/build/intermediates/compile_r_class_jar/debug/generateDebugRFile/R.jar +0 -0
  97. package/android/build/intermediates/compile_symbol_list/debug/generateDebugRFile/R.txt +0 -0
  98. package/android/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +1 -0
  99. package/android/build/intermediates/incremental/debug/packageDebugResources/merger.xml +2 -0
  100. package/android/build/intermediates/incremental/debug-mergeJavaRes/merge-state +0 -0
  101. package/android/build/intermediates/incremental/mergeDebugAssets/merger.xml +2 -0
  102. package/android/build/intermediates/incremental/mergeDebugJniLibFolders/merger.xml +2 -0
  103. package/android/build/intermediates/incremental/mergeDebugShaders/merger.xml +2 -0
  104. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/facebook/react/viewmanagers/RNPDFPdfViewManagerDelegate.class +0 -0
  105. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/facebook/react/viewmanagers/RNPDFPdfViewManagerInterface.class +0 -0
  106. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/wonday/pdf/BuildConfig.class +0 -0
  107. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/wonday/pdf/PdfManager.class +0 -0
  108. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/wonday/pdf/PdfView$1.class +0 -0
  109. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/wonday/pdf/PdfView$2.class +0 -0
  110. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/wonday/pdf/PdfView$3.class +0 -0
  111. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/wonday/pdf/PdfView.class +0 -0
  112. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/wonday/pdf/RNPDFPackage.class +0 -0
  113. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/wonday/pdf/events/TopChangeEvent.class +0 -0
  114. package/android/build/intermediates/local_only_symbol_list/debug/R-def.txt +2 -0
  115. package/android/build/intermediates/local_only_symbol_list/debug/parseDebugLocalResources/R-def.txt +2 -0
  116. package/android/build/intermediates/manifest_merge_blame_file/debug/manifest-merger-blame-debug-report.txt +8 -0
  117. package/android/build/intermediates/manifest_merge_blame_file/debug/processDebugManifest/manifest-merger-blame-debug-report.txt +7 -0
  118. package/android/build/intermediates/merged_java_res/debug/mergeDebugJavaResource/feature-react-native-pdf.jar +0 -0
  119. package/android/build/intermediates/merged_manifest/debug/AndroidManifest.xml +7 -0
  120. package/android/build/intermediates/merged_manifest/debug/processDebugManifest/AndroidManifest.xml +7 -0
  121. package/android/build/intermediates/navigation_json/debug/extractDeepLinksDebug/navigation.json +1 -0
  122. package/android/build/intermediates/navigation_json/debug/navigation.json +1 -0
  123. package/android/build/intermediates/nested_resources_validation_report/debug/generateDebugResources/nestedResourcesValidationReport.txt +1 -0
  124. package/android/build/intermediates/packaged_manifests/debug/output-metadata.json +18 -0
  125. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/facebook/react/viewmanagers/RNPDFPdfViewManagerDelegate.class +0 -0
  126. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/facebook/react/viewmanagers/RNPDFPdfViewManagerInterface.class +0 -0
  127. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/org/wonday/pdf/BuildConfig.class +0 -0
  128. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/org/wonday/pdf/PdfManager.class +0 -0
  129. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/org/wonday/pdf/PdfView$1.class +0 -0
  130. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/org/wonday/pdf/PdfView$2.class +0 -0
  131. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/org/wonday/pdf/PdfView$3.class +0 -0
  132. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/org/wonday/pdf/PdfView.class +0 -0
  133. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/org/wonday/pdf/RNPDFPackage.class +0 -0
  134. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/org/wonday/pdf/events/TopChangeEvent.class +0 -0
  135. package/android/build/intermediates/runtime_library_classes_jar/debug/bundleLibRuntimeToJarDebug/classes.jar +0 -0
  136. package/android/build/intermediates/symbol_list_with_package_name/debug/generateDebugRFile/package-aware-r.txt +1 -0
  137. package/android/build/outputs/aar/react-native-pdf-debug.aar +0 -0
  138. package/android/build/outputs/logs/manifest-merger-debug-report.txt +16 -0
  139. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/PdfManager.class.uniqueId3 +0 -0
  140. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/PdfManager.class.uniqueId4 +0 -0
  141. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/PdfView$1.class.uniqueId0 +0 -0
  142. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/PdfView$2.class.uniqueId5 +0 -0
  143. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/PdfView$2.class.uniqueId6 +0 -0
  144. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/PdfView$3.class.uniqueId4 +0 -0
  145. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/PdfView$3.class.uniqueId5 +0 -0
  146. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/PdfView.class.uniqueId2 +0 -0
  147. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/PdfView.class.uniqueId3 +0 -0
  148. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/RNPDFPackage.class.uniqueId1 +0 -0
  149. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/RNPDFPackage.class.uniqueId2 +0 -0
  150. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/RNPDFPdfViewManagerDelegate.class.uniqueId7 +0 -0
  151. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/RNPDFPdfViewManagerInterface.class.uniqueId1 +0 -0
  152. package/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
  153. package/android/build.gradle +148 -0
  154. package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  155. package/android/gradle/wrapper/gradle-wrapper.properties +7 -0
  156. package/android/gradle.properties +2 -0
  157. package/android/gradlew +249 -0
  158. package/android/gradlew.bat +92 -0
  159. package/android/local.properties +8 -0
  160. package/android/project.properties +12 -0
  161. package/android/src/main/AndroidManifest.xml +4 -0
  162. package/android/src/main/AndroidManifestNew.xml +4 -0
  163. package/android/src/main/java/org/wonday/pdf/PdfManager.java +196 -0
  164. package/android/src/main/java/org/wonday/pdf/PdfView.java +680 -0
  165. package/android/src/main/java/org/wonday/pdf/RNPDFPackage.java +39 -0
  166. package/android/src/main/java/org/wonday/pdf/events/TopChangeEvent.java +26 -0
  167. package/android/src/paper/java/com/facebook/react/viewmanagers/RNPDFPdfViewManagerDelegate.java +92 -0
  168. package/android/src/paper/java/com/facebook/react/viewmanagers/RNPDFPdfViewManagerInterface.java +35 -0
  169. package/fabric/RNPDFPdfNativeComponent.js +56 -0
  170. package/index.d.ts +83 -0
  171. package/index.js +524 -0
  172. package/index.js.flow +67 -0
  173. package/ios/RNPDFPdf/PdfManager.h +23 -0
  174. package/ios/RNPDFPdf/PdfManager.mm +152 -0
  175. package/ios/RNPDFPdf/RNPDFPdfPageView.h +21 -0
  176. package/ios/RNPDFPdf/RNPDFPdfPageView.mm +185 -0
  177. package/ios/RNPDFPdf/RNPDFPdfPageViewManager.h +18 -0
  178. package/ios/RNPDFPdf/RNPDFPdfPageViewManager.mm +30 -0
  179. package/ios/RNPDFPdf/RNPDFPdfView.h +60 -0
  180. package/ios/RNPDFPdf/RNPDFPdfView.mm +1101 -0
  181. package/ios/RNPDFPdf/RNPDFPdfViewManager.h +18 -0
  182. package/ios/RNPDFPdf/RNPDFPdfViewManager.mm +96 -0
  183. package/ios/RNPDFPdf.xcodeproj/project.pbxproj +321 -0
  184. package/package.json +73 -0
  185. package/react-native-pdf.podspec +30 -0
  186. package/windows/RCTPdf/PropertySheet.props +16 -0
  187. package/windows/RCTPdf/RCTPdf.def +3 -0
  188. package/windows/RCTPdf/RCTPdf.vcxproj +180 -0
  189. package/windows/RCTPdf/RCTPdf.vcxproj.filters +38 -0
  190. package/windows/RCTPdf/RCTPdfControl.cpp +667 -0
  191. package/windows/RCTPdf/RCTPdfControl.h +119 -0
  192. package/windows/RCTPdf/RCTPdfControl.idl +10 -0
  193. package/windows/RCTPdf/RCTPdfControl.xaml +33 -0
  194. package/windows/RCTPdf/RCTPdfViewManager.cpp +69 -0
  195. package/windows/RCTPdf/RCTPdfViewManager.h +51 -0
  196. package/windows/RCTPdf/ReactPackageProvider.cpp +15 -0
  197. package/windows/RCTPdf/ReactPackageProvider.h +16 -0
  198. package/windows/RCTPdf/ReactPackageProvider.idl +9 -0
  199. package/windows/RCTPdf/packages.config +4 -0
  200. package/windows/RCTPdf/pch.cpp +1 -0
  201. package/windows/RCTPdf/pch.h +31 -0
  202. package/windows/README.md +21 -0
@@ -0,0 +1,1101 @@
1
+ /**
2
+ * Copyright (c) 2017-present, Wonday (@wonday.org)
3
+ * All rights reserved.
4
+ *
5
+ * This source code is licensed under the MIT-style license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+
9
+ #import "RNPDFPdfView.h"
10
+
11
+ #import <Foundation/Foundation.h>
12
+ #import <QuartzCore/QuartzCore.h>
13
+ #import <PDFKit/PDFKit.h>
14
+
15
+ #if __has_include(<React/RCTAssert.h>)
16
+ #import <React/RCTBridgeModule.h>
17
+ #import <React/RCTEventDispatcher.h>
18
+ #import <React/UIView+React.h>
19
+ #import <React/RCTLog.h>
20
+ #import <React/RCTBlobManager.h>
21
+ #else
22
+ #import "RCTBridgeModule.h"
23
+ #import "RCTEventDispatcher.h"
24
+ #import "UIView+React.h"
25
+ #import "RCTLog.h"
26
+ #import <RCTBlobManager.h">
27
+ #endif
28
+
29
+ #ifdef RCT_NEW_ARCH_ENABLED
30
+ #import <React/RCTConversions.h>
31
+ #import <React/RCTFabricComponentsPlugins.h>
32
+ #import <react/renderer/components/rnpdf/ComponentDescriptors.h>
33
+ #import <react/renderer/components/rnpdf/Props.h>
34
+ #import <react/renderer/components/rnpdf/RCTComponentViewHelpers.h>
35
+
36
+ // Some RN private method hacking below similar to how it is done in RNScreens:
37
+ // https://github.com/software-mansion/react-native-screens/blob/90e548739f35b5ded2524a9d6410033fc233f586/ios/RNSScreenStackHeaderConfig.mm#L30
38
+ @interface RCTBridge (Private)
39
+ + (RCTBridge *)currentBridge;
40
+ @end
41
+
42
+ #endif
43
+
44
+ #ifndef __OPTIMIZE__
45
+ // only output log when debug
46
+ #define DLog( s, ... ) NSLog( @"<%p %@:(%d)> %@", self, [[NSString stringWithUTF8String:__FILE__] lastPathComponent], __LINE__, [NSString stringWithFormat:(s), ##__VA_ARGS__] )
47
+ #else
48
+ #define DLog( s, ... )
49
+ #endif
50
+
51
+ // output log both debug and release
52
+ #define RLog( s, ... ) NSLog( @"<%p %@:(%d)> %@", self, [[NSString stringWithUTF8String:__FILE__] lastPathComponent], __LINE__, [NSString stringWithFormat:(s), ##__VA_ARGS__] )
53
+
54
+ const float MAX_SCALE = 3.0f;
55
+ const float MIN_SCALE = 1.0f;
56
+
57
+ @interface RNPDFPdfView() <PDFDocumentDelegate, PDFViewDelegate
58
+ #ifdef RCT_NEW_ARCH_ENABLED
59
+ , RCTRNPDFPdfViewViewProtocol
60
+ #endif
61
+ >
62
+ @end
63
+
64
+ @implementation RNPDFPdfView
65
+ {
66
+ RCTBridge *_bridge;
67
+ PDFDocument *_pdfDocument;
68
+ PDFView *_pdfView;
69
+ PDFOutline *root;
70
+ float _fixScaleFactor;
71
+ bool _initialed;
72
+ NSArray<NSString *> *_changedProps;
73
+ UITapGestureRecognizer *_doubleTapRecognizer;
74
+ UITapGestureRecognizer *_singleTapRecognizer;
75
+ UIPinchGestureRecognizer *_pinchRecognizer;
76
+ UILongPressGestureRecognizer *_longPressRecognizer;
77
+ UITapGestureRecognizer *_doubleTapEmptyRecognizer;
78
+
79
+ // Autoscroll
80
+ CADisplayLink *_displayLink;
81
+ NSTimer *_autoScrollResumeTimer;
82
+ CGFloat _autoScrollPixels; // pixels per second
83
+ NSTimeInterval _autoScrollResumeDelay;
84
+ BOOL _isAutoScrolling;
85
+ BOOL _isUserDragging;
86
+ UIScrollView *_pdfScrollView;
87
+ __weak id<UIScrollViewDelegate> _originalScrollDelegate;
88
+ }
89
+
90
+ #ifdef RCT_NEW_ARCH_ENABLED
91
+
92
+ using namespace facebook::react;
93
+
94
+ + (ComponentDescriptorProvider)componentDescriptorProvider
95
+ {
96
+ return concreteComponentDescriptorProvider<RNPDFPdfViewComponentDescriptor>();
97
+ }
98
+
99
+ // Needed because of this: https://github.com/facebook/react-native/pull/37274
100
+ + (void)load
101
+ {
102
+ [super load];
103
+ }
104
+
105
+ - (instancetype)initWithFrame:(CGRect)frame
106
+ {
107
+ if (self = [super initWithFrame:frame]) {
108
+ static const auto defaultProps = std::make_shared<const RNPDFPdfViewProps>();
109
+ _props = defaultProps;
110
+ [self initCommonProps];
111
+ }
112
+ return self;
113
+ }
114
+
115
+ - (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &)oldProps
116
+ {
117
+ const auto &newProps = *std::static_pointer_cast<const RNPDFPdfViewProps>(props);
118
+ NSMutableArray<NSString *> *updatedPropNames = [NSMutableArray new];
119
+ if (_path != RCTNSStringFromStringNilIfEmpty(newProps.path)) {
120
+ _path = RCTNSStringFromStringNilIfEmpty(newProps.path);
121
+ [updatedPropNames addObject:@"path"];
122
+ }
123
+ if (_page != newProps.page) {
124
+ _page = newProps.page;
125
+ [updatedPropNames addObject:@"page"];
126
+ }
127
+ if (_scale != newProps.scale) {
128
+ _scale = newProps.scale;
129
+ [updatedPropNames addObject:@"scale"];
130
+ }
131
+ if (_minScale != newProps.minScale) {
132
+ _minScale = newProps.minScale;
133
+ [updatedPropNames addObject:@"minScale"];
134
+ }
135
+ if (_maxScale != newProps.maxScale) {
136
+ _maxScale = newProps.maxScale;
137
+ [updatedPropNames addObject:@"maxScale"];
138
+ }
139
+ if (_horizontal != newProps.horizontal) {
140
+ _horizontal = newProps.horizontal;
141
+ [updatedPropNames addObject:@"horizontal"];
142
+ }
143
+ if (_enablePaging != newProps.enablePaging) {
144
+ _enablePaging = newProps.enablePaging;
145
+ [updatedPropNames addObject:@"enablePaging"];
146
+ }
147
+ if (_enableRTL != newProps.enableRTL) {
148
+ _enableRTL = newProps.enableRTL;
149
+ [updatedPropNames addObject:@"enableRTL"];
150
+ }
151
+ if (_enableAnnotationRendering != newProps.enableAnnotationRendering) {
152
+ _enableAnnotationRendering = newProps.enableAnnotationRendering;
153
+ [updatedPropNames addObject:@"enableAnnotationRendering"];
154
+ }
155
+ if (_enableDoubleTapZoom != newProps.enableDoubleTapZoom) {
156
+ _enableDoubleTapZoom = newProps.enableDoubleTapZoom;
157
+ [updatedPropNames addObject:@"enableDoubleTapZoom"];
158
+ }
159
+ if (_fitPolicy != newProps.fitPolicy) {
160
+ _fitPolicy = newProps.fitPolicy;
161
+ [updatedPropNames addObject:@"fitPolicy"];
162
+ }
163
+ if (_spacing != newProps.spacing) {
164
+ _spacing = newProps.spacing;
165
+ [updatedPropNames addObject:@"spacing"];
166
+ }
167
+ if (_password != RCTNSStringFromStringNilIfEmpty(newProps.password)) {
168
+ _password = RCTNSStringFromStringNilIfEmpty(newProps.password);
169
+ [updatedPropNames addObject:@"password"];
170
+ }
171
+ if (_singlePage != newProps.singlePage) {
172
+ _singlePage = newProps.singlePage;
173
+ [updatedPropNames addObject:@"singlePage"];
174
+ }
175
+ if (_showsHorizontalScrollIndicator != newProps.showsHorizontalScrollIndicator) {
176
+ _showsHorizontalScrollIndicator = newProps.showsHorizontalScrollIndicator;
177
+ [updatedPropNames addObject:@"showsHorizontalScrollIndicator"];
178
+ }
179
+ if (_showsVerticalScrollIndicator != newProps.showsVerticalScrollIndicator) {
180
+ _showsVerticalScrollIndicator = newProps.showsVerticalScrollIndicator;
181
+ [updatedPropNames addObject:@"showsVerticalScrollIndicator"];
182
+ }
183
+
184
+ if (_scrollEnabled != newProps.scrollEnabled) {
185
+ _scrollEnabled = newProps.scrollEnabled;
186
+ [updatedPropNames addObject:@"scrollEnabled"];
187
+ }
188
+
189
+ [super updateProps:props oldProps:oldProps];
190
+ [self didSetProps:updatedPropNames];
191
+ }
192
+
193
+ // already added in case https://github.com/facebook/react-native/pull/35378 has been merged
194
+ - (BOOL)shouldBeRecycled
195
+ {
196
+ return NO;
197
+ }
198
+
199
+ - (void)prepareForRecycle
200
+ {
201
+ [super prepareForRecycle];
202
+
203
+ [self stopAutoScroll];
204
+ _pdfScrollView = nil;
205
+ _originalScrollDelegate = nil;
206
+
207
+ [_pdfView removeFromSuperview];
208
+ _pdfDocument = Nil;
209
+ _pdfView = Nil;
210
+ //Remove notifications
211
+ [[NSNotificationCenter defaultCenter] removeObserver:self name:@"PDFViewDocumentChangedNotification" object:nil];
212
+ [[NSNotificationCenter defaultCenter] removeObserver:self name:@"PDFViewPageChangedNotification" object:nil];
213
+ [[NSNotificationCenter defaultCenter] removeObserver:self name:@"PDFViewScaleChangedNotification" object:nil];
214
+
215
+ // remove old recognizers before adding new ones
216
+ [self removeGestureRecognizer:_doubleTapRecognizer];
217
+ [self removeGestureRecognizer:_singleTapRecognizer];
218
+ [self removeGestureRecognizer:_pinchRecognizer];
219
+ [self removeGestureRecognizer:_longPressRecognizer];
220
+ [self removeGestureRecognizer:_doubleTapEmptyRecognizer];
221
+
222
+ [self initCommonProps];
223
+ }
224
+
225
+ - (void)updateLayoutMetrics:(const facebook::react::LayoutMetrics &)layoutMetrics oldLayoutMetrics:(const facebook::react::LayoutMetrics &)oldLayoutMetrics
226
+ {
227
+ // Fabric equivalent of `reactSetFrame` method
228
+ [super updateLayoutMetrics:layoutMetrics oldLayoutMetrics:oldLayoutMetrics];
229
+ _pdfView.frame = CGRectMake(0, 0, layoutMetrics.frame.size.width, layoutMetrics.frame.size.height);
230
+
231
+ NSMutableArray *mProps = [_changedProps mutableCopy];
232
+ if (_initialed) {
233
+ [mProps removeObject:@"path"];
234
+ }
235
+ _initialed = YES;
236
+
237
+ [self didSetProps:mProps];
238
+ }
239
+
240
+ - (void)handleCommand:(const NSString *)commandName args:(const NSArray *)args
241
+ {
242
+ RCTRNPDFPdfViewHandleCommand(self, commandName, args);
243
+ }
244
+
245
+ - (void)setNativePage:(NSInteger)page
246
+ {
247
+ _page = page;
248
+ [self didSetProps:[NSArray arrayWithObject:@"page"]];
249
+ }
250
+
251
+ - (void)startNativeAutoScroll:(double)pixels resumeDelay:(double)resumeDelay
252
+ {
253
+ [self startAutoScroll:(CGFloat)pixels resumeDelay:(NSTimeInterval)(resumeDelay / 1000.0)];
254
+ }
255
+
256
+ - (void)stopNativeAutoScroll
257
+ {
258
+ [self stopAutoScroll];
259
+ }
260
+
261
+ #endif
262
+
263
+ - (instancetype)initWithBridge:(RCTBridge *)bridge
264
+ {
265
+ self = [super init];
266
+ if (self) {
267
+ _bridge = bridge;
268
+ [self initCommonProps];
269
+ }
270
+
271
+ return self;
272
+ }
273
+
274
+ - (void)initCommonProps
275
+ {
276
+ _page = 1;
277
+ _scale = 1;
278
+ _minScale = MIN_SCALE;
279
+ _maxScale = MAX_SCALE;
280
+ _horizontal = NO;
281
+ _enablePaging = NO;
282
+ _enableRTL = NO;
283
+ _enableAnnotationRendering = YES;
284
+ _enableDoubleTapZoom = YES;
285
+ _fitPolicy = 2;
286
+ _spacing = 10;
287
+ _singlePage = NO;
288
+ _showsHorizontalScrollIndicator = YES;
289
+ _showsVerticalScrollIndicator = YES;
290
+ _scrollEnabled = YES;
291
+
292
+ // init and config PDFView
293
+ _pdfView = [[PDFView alloc] initWithFrame:CGRectMake(0, 0, 500, 500)];
294
+ _pdfView.displayMode = kPDFDisplaySinglePageContinuous;
295
+ _pdfView.autoScales = YES;
296
+ _pdfView.displaysPageBreaks = YES;
297
+ _pdfView.displayBox = kPDFDisplayBoxCropBox;
298
+ _pdfView.backgroundColor = [UIColor clearColor];
299
+
300
+ _fixScaleFactor = -1.0f;
301
+ _initialed = NO;
302
+ _changedProps = NULL;
303
+
304
+ // Autoscroll defaults
305
+ _autoScrollPixels = 15.0f; // px/sec
306
+ _autoScrollResumeDelay = 3.0;
307
+ _isAutoScrolling = NO;
308
+ _isUserDragging = NO;
309
+ _pdfScrollView = nil;
310
+ _originalScrollDelegate = nil;
311
+
312
+ [self addSubview:_pdfView];
313
+
314
+
315
+ // register notification
316
+ NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
317
+ [center addObserver:self selector:@selector(onDocumentChanged:) name:PDFViewDocumentChangedNotification object:_pdfView];
318
+ [center addObserver:self selector:@selector(onPageChanged:) name:PDFViewPageChangedNotification object:_pdfView];
319
+ [center addObserver:self selector:@selector(onScaleChanged:) name:PDFViewScaleChangedNotification object:_pdfView];
320
+
321
+ [[_pdfView document] setDelegate: self];
322
+ [_pdfView setDelegate: self];
323
+
324
+ // Disable built-in double tap, so as not to conflict with custom recognizers.
325
+ for (UIGestureRecognizer *recognizer in _pdfView.gestureRecognizers) {
326
+ if ([recognizer isKindOfClass:[UITapGestureRecognizer class]]) {
327
+ UITapGestureRecognizer *tap = (UITapGestureRecognizer *)recognizer;
328
+ if (tap.numberOfTapsRequired == 2) {
329
+ recognizer.enabled = NO;
330
+ }
331
+ }
332
+ }
333
+
334
+ [self bindTap];
335
+ }
336
+
337
+ - (void)PDFViewWillClickOnLink:(PDFView *)sender withURL:(NSURL *)url
338
+ {
339
+ NSString *_url = url.absoluteString;
340
+ [self notifyOnChangeWithMessage:
341
+ [[NSString alloc] initWithString:
342
+ [NSString stringWithFormat:
343
+ @"linkPressed|%s", _url.UTF8String]]];
344
+ }
345
+
346
+ - (void)didSetProps:(NSArray<NSString *> *)changedProps
347
+ {
348
+ if (!_initialed) {
349
+
350
+ _changedProps = changedProps;
351
+
352
+ } else {
353
+
354
+ if ([changedProps containsObject:@"path"]) {
355
+
356
+
357
+ if (_pdfDocument != Nil) {
358
+ //Release old doc
359
+ _pdfDocument = Nil;
360
+ }
361
+
362
+ if ([_path hasPrefix:@"blob:"]) {
363
+ RCTBlobManager *blobManager = [
364
+ #ifdef RCT_NEW_ARCH_ENABLED
365
+ [RCTBridge currentBridge]
366
+ #else
367
+ _bridge
368
+ #endif // RCT_NEW_ARCH_ENABLED
369
+ moduleForName:@"BlobModule"];
370
+ NSURL *blobURL = [NSURL URLWithString:_path];
371
+ NSData *blobData = [blobManager resolveURL:blobURL];
372
+ if (blobData != nil) {
373
+ _pdfDocument = [[PDFDocument alloc] initWithData:blobData];
374
+ }
375
+ } else {
376
+
377
+ // decode file path
378
+ _path = (__bridge_transfer NSString *)CFURLCreateStringByReplacingPercentEscapes(NULL, (CFStringRef)_path, CFSTR(""));
379
+ NSURL *fileURL = [NSURL fileURLWithPath:_path];
380
+ _pdfDocument = [[PDFDocument alloc] initWithURL:fileURL];
381
+ }
382
+
383
+ if (_pdfDocument) {
384
+
385
+ //check need password or not
386
+ if (_pdfDocument.isLocked && ![_pdfDocument unlockWithPassword:_password]) {
387
+
388
+ [self notifyOnChangeWithMessage:@"error|Password required or incorrect password."];
389
+
390
+ _pdfDocument = Nil;
391
+ return;
392
+ }
393
+
394
+ _pdfView.document = _pdfDocument;
395
+ } else {
396
+
397
+ [self notifyOnChangeWithMessage:[[NSString alloc] initWithString:[NSString stringWithFormat:@"error|Load pdf failed. path=%s",_path.UTF8String]]];
398
+
399
+ _pdfDocument = Nil;
400
+ return;
401
+ }
402
+ }
403
+
404
+ if (_pdfDocument && ([changedProps containsObject:@"path"] || [changedProps containsObject:@"spacing"])) {
405
+ if (_horizontal) {
406
+ _pdfView.pageBreakMargins = UIEdgeInsetsMake(0,_spacing,0,0);
407
+ if (_spacing==0) {
408
+ if (@available(iOS 12.0, *)) {
409
+ _pdfView.pageShadowsEnabled = NO;
410
+ }
411
+ } else {
412
+ if (@available(iOS 12.0, *)) {
413
+ _pdfView.pageShadowsEnabled = YES;
414
+ }
415
+ }
416
+ } else {
417
+ _pdfView.pageBreakMargins = UIEdgeInsetsMake(0,0,_spacing,0);
418
+ if (_spacing==0) {
419
+ if (@available(iOS 12.0, *)) {
420
+ _pdfView.pageShadowsEnabled = NO;
421
+ }
422
+ } else {
423
+ if (@available(iOS 12.0, *)) {
424
+ _pdfView.pageShadowsEnabled = YES;
425
+ }
426
+ }
427
+ }
428
+ }
429
+
430
+ if (_pdfDocument && ([changedProps containsObject:@"path"] || [changedProps containsObject:@"enableRTL"])) {
431
+ _pdfView.displaysRTL = _enableRTL;
432
+ }
433
+
434
+ if (_pdfDocument && ([changedProps containsObject:@"path"] || [changedProps containsObject:@"enableAnnotationRendering"])) {
435
+ if (!_enableAnnotationRendering) {
436
+ for (unsigned long i=0; i<_pdfView.document.pageCount; i++) {
437
+ PDFPage *pdfPage = [_pdfView.document pageAtIndex:i];
438
+ for (unsigned long j=0; j<pdfPage.annotations.count; j++) {
439
+ pdfPage.annotations[j].shouldDisplay = _enableAnnotationRendering;
440
+ }
441
+ }
442
+ }
443
+ }
444
+
445
+ if (_pdfDocument && ([changedProps containsObject:@"path"] || [changedProps containsObject:@"fitPolicy"] || [changedProps containsObject:@"minScale"] || [changedProps containsObject:@"maxScale"])) {
446
+
447
+ PDFPage *pdfPage = _pdfView.currentPage ? _pdfView.currentPage : [_pdfDocument pageAtIndex:_pdfDocument.pageCount-1];
448
+ CGRect pdfPageRect = [pdfPage boundsForBox:kPDFDisplayBoxCropBox];
449
+
450
+ // some pdf with rotation, then adjust it
451
+ if (pdfPage.rotation == 90 || pdfPage.rotation == 270) {
452
+ pdfPageRect = CGRectMake(0, 0, pdfPageRect.size.height, pdfPageRect.size.width);
453
+ }
454
+
455
+ if (_fitPolicy == 0) {
456
+ _fixScaleFactor = self.frame.size.width/pdfPageRect.size.width;
457
+ _pdfView.scaleFactor = _scale * _fixScaleFactor;
458
+ _pdfView.minScaleFactor = _fixScaleFactor*_minScale;
459
+ _pdfView.maxScaleFactor = _fixScaleFactor*_maxScale;
460
+ } else if (_fitPolicy == 1) {
461
+ _fixScaleFactor = self.frame.size.height/pdfPageRect.size.height;
462
+ _pdfView.scaleFactor = _scale * _fixScaleFactor;
463
+ _pdfView.minScaleFactor = _fixScaleFactor*_minScale;
464
+ _pdfView.maxScaleFactor = _fixScaleFactor*_maxScale;
465
+ } else {
466
+ float pageAspect = pdfPageRect.size.width/pdfPageRect.size.height;
467
+ float reactViewAspect = self.frame.size.width/self.frame.size.height;
468
+ if (reactViewAspect>pageAspect) {
469
+ _fixScaleFactor = self.frame.size.height/pdfPageRect.size.height;
470
+ _pdfView.scaleFactor = _scale * _fixScaleFactor;
471
+ _pdfView.minScaleFactor = _fixScaleFactor*_minScale;
472
+ _pdfView.maxScaleFactor = _fixScaleFactor*_maxScale;
473
+ } else {
474
+ _fixScaleFactor = self.frame.size.width/pdfPageRect.size.width;
475
+ _pdfView.scaleFactor = _scale * _fixScaleFactor;
476
+ _pdfView.minScaleFactor = _fixScaleFactor*_minScale;
477
+ _pdfView.maxScaleFactor = _fixScaleFactor*_maxScale;
478
+ }
479
+ }
480
+
481
+ }
482
+
483
+ if (_pdfDocument && ([changedProps containsObject:@"path"] || [changedProps containsObject:@"scale"])) {
484
+ _pdfView.scaleFactor = _scale * _fixScaleFactor;
485
+ if (_pdfView.scaleFactor>_pdfView.maxScaleFactor) _pdfView.scaleFactor = _pdfView.maxScaleFactor;
486
+ if (_pdfView.scaleFactor<_pdfView.minScaleFactor) _pdfView.scaleFactor = _pdfView.minScaleFactor;
487
+ }
488
+
489
+ if (_pdfDocument && ([changedProps containsObject:@"path"] || [changedProps containsObject:@"horizontal"])) {
490
+ if (_horizontal) {
491
+ _pdfView.displayDirection = kPDFDisplayDirectionHorizontal;
492
+ _pdfView.pageBreakMargins = UIEdgeInsetsMake(0,_spacing,0,0);
493
+ } else {
494
+ _pdfView.displayDirection = kPDFDisplayDirectionVertical;
495
+ _pdfView.pageBreakMargins = UIEdgeInsetsMake(0,0,_spacing,0);
496
+ }
497
+ }
498
+
499
+ if (_pdfDocument && ([changedProps containsObject:@"path"] || [changedProps containsObject:@"enablePaging"])) {
500
+ if (_enablePaging) {
501
+ [_pdfView usePageViewController:YES withViewOptions:@{UIPageViewControllerOptionSpineLocationKey:@(UIPageViewControllerSpineLocationMin),UIPageViewControllerOptionInterPageSpacingKey:@(_spacing)}];
502
+ } else {
503
+ [_pdfView usePageViewController:NO withViewOptions:Nil];
504
+ }
505
+ }
506
+
507
+ if (_pdfDocument && ([changedProps containsObject:@"path"] || [changedProps containsObject:@"singlePage"])) {
508
+ if (_singlePage) {
509
+ _pdfView.displayMode = kPDFDisplaySinglePage;
510
+ _pdfView.userInteractionEnabled = NO;
511
+ } else {
512
+ _pdfView.displayMode = kPDFDisplaySinglePageContinuous;
513
+ _pdfView.userInteractionEnabled = YES;
514
+ }
515
+ }
516
+
517
+ if (_pdfDocument && ([changedProps containsObject:@"path"] || [changedProps containsObject:@"showsHorizontalScrollIndicator"] || [changedProps containsObject:@"showsVerticalScrollIndicator"])) {
518
+ [self setScrollIndicators:self horizontal:_showsHorizontalScrollIndicator vertical:_showsVerticalScrollIndicator depth:0];
519
+ }
520
+
521
+ if (_pdfDocument && ([changedProps containsObject:@"path"] || [changedProps containsObject:@"scrollEnabled"])) {
522
+ if (_scrollEnabled) {
523
+ for (UIView *subview in _pdfView.subviews) {
524
+ if ([subview isKindOfClass:[UIScrollView class]]) {
525
+ UIScrollView *scrollView = (UIScrollView *)subview;
526
+ scrollView.scrollEnabled = YES;
527
+ }
528
+ }
529
+ } else {
530
+ for (UIView *subview in _pdfView.subviews) {
531
+ if ([subview isKindOfClass:[UIScrollView class]]) {
532
+ UIScrollView *scrollView = (UIScrollView *)subview;
533
+ scrollView.scrollEnabled = NO;
534
+ }
535
+ }
536
+ }
537
+ }
538
+
539
+ if (_pdfDocument && ([changedProps containsObject:@"path"] || [changedProps containsObject:@"enablePaging"] || [changedProps containsObject:@"horizontal"] || [changedProps containsObject:@"page"])) {
540
+
541
+ PDFPage *pdfPage = [_pdfDocument pageAtIndex:_page-1];
542
+ if (pdfPage && _page == 1) {
543
+ // goToDestination() would be better. However, there is an
544
+ // error in the pointLeftTop computation that often results in
545
+ // scrolling to the middle of the page.
546
+ // Special case workaround to make starting at the first page
547
+ // align acceptably.
548
+ dispatch_async(dispatch_get_main_queue(), ^{
549
+ [self->_pdfView goToRect:CGRectMake(0, NSUIntegerMax, 1, 1) onPage:pdfPage];
550
+ });
551
+ } else if (pdfPage) {
552
+ CGRect pdfPageRect = [pdfPage boundsForBox:kPDFDisplayBoxCropBox];
553
+
554
+ // some pdf with rotation, then adjust it
555
+ if (pdfPage.rotation == 90 || pdfPage.rotation == 270) {
556
+ pdfPageRect = CGRectMake(0, 0, pdfPageRect.size.height, pdfPageRect.size.width);
557
+ }
558
+
559
+ CGPoint pointLeftTop = CGPointMake(0, pdfPageRect.size.height);
560
+ PDFDestination *pdfDest = [[PDFDestination alloc] initWithPage:pdfPage atPoint:pointLeftTop];
561
+ [_pdfView goToDestination:pdfDest];
562
+ _pdfView.scaleFactor = _fixScaleFactor*_scale;
563
+ }
564
+ }
565
+
566
+ _pdfView.backgroundColor = [UIColor clearColor];
567
+ [_pdfView layoutDocumentView];
568
+ [self setNeedsDisplay];
569
+ }
570
+ }
571
+
572
+
573
+ - (void)reactSetFrame:(CGRect)frame
574
+ {
575
+ [super reactSetFrame:frame];
576
+ _pdfView.frame = CGRectMake(0, 0, frame.size.width, frame.size.height);
577
+
578
+ NSMutableArray *mProps = [_changedProps mutableCopy];
579
+ if (_initialed) {
580
+ [mProps removeObject:@"path"];
581
+ }
582
+ _initialed = YES;
583
+
584
+ [self didSetProps:mProps];
585
+ }
586
+
587
+
588
+ - (void)notifyOnChangeWithMessage:(NSString *)message
589
+ {
590
+ #ifdef RCT_NEW_ARCH_ENABLED
591
+ if (_eventEmitter != nullptr) {
592
+ std::dynamic_pointer_cast<const RNPDFPdfViewEventEmitter>(_eventEmitter)
593
+ ->onChange(RNPDFPdfViewEventEmitter::OnChange{.message = RCTStringFromNSString(message)});
594
+ }
595
+ #else
596
+ _onChange(@{ @"message": message});
597
+ #endif
598
+ }
599
+
600
+ - (void)dealloc{
601
+
602
+ [self stopAutoScroll];
603
+
604
+ _pdfDocument = Nil;
605
+ _pdfView = Nil;
606
+
607
+ //Remove notifications
608
+ [[NSNotificationCenter defaultCenter] removeObserver:self name:@"PDFViewDocumentChangedNotification" object:nil];
609
+ [[NSNotificationCenter defaultCenter] removeObserver:self name:@"PDFViewPageChangedNotification" object:nil];
610
+ [[NSNotificationCenter defaultCenter] removeObserver:self name:@"PDFViewScaleChangedNotification" object:nil];
611
+
612
+ _doubleTapRecognizer = nil;
613
+ _singleTapRecognizer = nil;
614
+ _pinchRecognizer = nil;
615
+ _longPressRecognizer = nil;
616
+ _doubleTapEmptyRecognizer = nil;
617
+ }
618
+
619
+ #pragma mark notification process
620
+ - (void)onDocumentChanged:(NSNotification *)noti
621
+ {
622
+
623
+ if (_pdfDocument) {
624
+
625
+ unsigned long numberOfPages = _pdfDocument.pageCount;
626
+ PDFPage *page = [_pdfDocument pageAtIndex:_pdfDocument.pageCount-1];
627
+ CGSize pageSize = [_pdfView rowSizeForPage:page];
628
+ NSString *jsonString = [self getTableContents];
629
+
630
+ [self notifyOnChangeWithMessage:
631
+ [[NSString alloc] initWithString:[NSString stringWithFormat:@"loadComplete|%lu|%f|%f|%@", numberOfPages, pageSize.width, pageSize.height,jsonString]]];
632
+ }
633
+
634
+ }
635
+
636
+ -(NSString *) getTableContents
637
+ {
638
+
639
+ NSMutableArray<PDFOutline *> *arrTableOfContents = [[NSMutableArray alloc] init];
640
+
641
+ if (_pdfDocument.outlineRoot) {
642
+
643
+ PDFOutline *currentRoot = _pdfDocument.outlineRoot;
644
+ NSMutableArray<PDFOutline *> *stack = [[NSMutableArray alloc] init];
645
+
646
+ [stack addObject:currentRoot];
647
+
648
+ while (stack.count > 0) {
649
+
650
+ PDFOutline *currentOutline = stack.lastObject;
651
+ [stack removeLastObject];
652
+
653
+ if (currentOutline.label.length > 0){
654
+ [arrTableOfContents addObject:currentOutline];
655
+ }
656
+
657
+ for ( NSInteger i= currentOutline.numberOfChildren; i > 0; i-- )
658
+ {
659
+ [stack addObject:[currentOutline childAtIndex:i-1]];
660
+ }
661
+ }
662
+ }
663
+
664
+ NSMutableArray *arrParentsContents = [[NSMutableArray alloc] init];
665
+
666
+ for ( NSInteger i= 0; i < arrTableOfContents.count; i++ )
667
+ {
668
+ PDFOutline *currentOutline = [arrTableOfContents objectAtIndex:i];
669
+
670
+ NSInteger indentationLevel = -1;
671
+
672
+ PDFOutline *parentOutline = currentOutline.parent;
673
+
674
+ while (parentOutline != nil) {
675
+ indentationLevel += 1;
676
+ parentOutline = parentOutline.parent;
677
+ }
678
+
679
+ if (indentationLevel == 0) {
680
+
681
+ NSMutableDictionary *DXParentsContent = [[NSMutableDictionary alloc] init];
682
+
683
+ [DXParentsContent setObject:[[NSMutableArray alloc] init] forKey:@"children"];
684
+ [DXParentsContent setObject:@"" forKey:@"mNativePtr"];
685
+ [DXParentsContent setObject:[NSString stringWithFormat:@"%lu", [_pdfDocument indexForPage:currentOutline.destination.page]] forKey:@"pageIdx"];
686
+ [DXParentsContent setObject:currentOutline.label forKey:@"title"];
687
+
688
+ //currentOutlin
689
+ //mNativePtr
690
+ [arrParentsContents addObject:DXParentsContent];
691
+ }
692
+ else {
693
+ NSMutableDictionary *DXParentsContent = [arrParentsContents lastObject];
694
+
695
+ NSMutableArray *arrChildren = [DXParentsContent valueForKey:@"children"];
696
+
697
+ while (indentationLevel > 1) {
698
+ NSMutableDictionary *DXchild = [arrChildren lastObject];
699
+ arrChildren = [DXchild valueForKey:@"children"];
700
+ indentationLevel--;
701
+ }
702
+
703
+ NSMutableDictionary *DXChildContent = [[NSMutableDictionary alloc] init];
704
+ [DXChildContent setObject:[[NSMutableArray alloc] init] forKey:@"children"];
705
+ [DXChildContent setObject:@"" forKey:@"mNativePtr"];
706
+ [DXChildContent setObject:[NSString stringWithFormat:@"%lu", [_pdfDocument indexForPage:currentOutline.destination.page]] forKey:@"pageIdx"];
707
+ [DXChildContent setObject:currentOutline.label forKey:@"title"];
708
+ [arrChildren addObject:DXChildContent];
709
+
710
+ }
711
+ }
712
+
713
+ NSError *error;
714
+ NSData *jsonData = [NSJSONSerialization dataWithJSONObject:arrParentsContents options:NSJSONWritingPrettyPrinted error:&error];
715
+
716
+ NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
717
+
718
+ return jsonString;
719
+
720
+ }
721
+
722
+ - (void)onPageChanged:(NSNotification *)noti
723
+ {
724
+
725
+ if (_pdfDocument) {
726
+ PDFPage *currentPage = _pdfView.currentPage;
727
+ unsigned long page = [_pdfDocument indexForPage:currentPage];
728
+ unsigned long numberOfPages = _pdfDocument.pageCount;
729
+
730
+ [self notifyOnChangeWithMessage:[[NSString alloc] initWithString:[NSString stringWithFormat:@"pageChanged|%lu|%lu", page+1, numberOfPages]]];
731
+ }
732
+
733
+ }
734
+
735
+ - (void)onScaleChanged:(NSNotification *)noti
736
+ {
737
+
738
+ if (_initialed && _fixScaleFactor>0) {
739
+ if (_scale != _pdfView.scaleFactor/_fixScaleFactor) {
740
+ _scale = _pdfView.scaleFactor/_fixScaleFactor;
741
+ [self notifyOnChangeWithMessage:[[NSString alloc] initWithString:[NSString stringWithFormat:@"scaleChanged|%f", _scale]]];
742
+ }
743
+ }
744
+ }
745
+
746
+ #pragma mark gesture process
747
+
748
+ /**
749
+ * Empty double tap handler
750
+ *
751
+ *
752
+ */
753
+ - (void)handleDoubleTapEmpty:(UITapGestureRecognizer *)recognizer {}
754
+
755
+ /**
756
+ * Tap
757
+ * zoom reset or zoom in
758
+ *
759
+ * @param recognizer
760
+ */
761
+ - (void)handleDoubleTap:(UITapGestureRecognizer *)recognizer
762
+ {
763
+
764
+ // Prevent double tap from selecting text.
765
+ dispatch_async(dispatch_get_main_queue(), ^{
766
+ [self->_pdfView clearSelection];
767
+ });
768
+
769
+ // Event appears to be consumed; broadcast for JS.
770
+ // _onChange(@{ @"message": @"pageDoubleTap" });
771
+
772
+ if (!_enableDoubleTapZoom) {
773
+ return;
774
+ }
775
+
776
+ // Cycle through min/mid/max scale factors to be consistent with Android
777
+ float min = self->_pdfView.minScaleFactor/self->_fixScaleFactor;
778
+ float max = self->_pdfView.maxScaleFactor/self->_fixScaleFactor;
779
+ float mid = (max - min) / 2 + min;
780
+ float scale = self->_scale;
781
+ if (self->_scale < mid) {
782
+ scale = mid;
783
+ } else if (self->_scale < max) {
784
+ scale = max;
785
+ } else {
786
+ scale = min;
787
+ }
788
+
789
+ CGFloat newScale = scale * self->_fixScaleFactor;
790
+ CGPoint tapPoint = [recognizer locationInView:self->_pdfView];
791
+
792
+ PDFPage *tappedPdfPage = [_pdfView pageForPoint:tapPoint nearest:NO];
793
+ PDFPage *pageRef;
794
+ if (tappedPdfPage) {
795
+ pageRef = tappedPdfPage;
796
+ } else {
797
+ pageRef = self->_pdfView.currentPage;
798
+ }
799
+ tapPoint = [self->_pdfView convertPoint:tapPoint toPage:pageRef];
800
+
801
+ CGRect tempZoomRect = CGRectZero;
802
+ tempZoomRect.size.width = self->_pdfView.frame.size.width;
803
+ tempZoomRect.size.height = 1;
804
+ tempZoomRect.origin = tapPoint;
805
+
806
+ dispatch_async(dispatch_get_main_queue(), ^{
807
+ [UIView animateWithDuration:0.3 animations:^{
808
+ [self->_pdfView setScaleFactor:newScale];
809
+
810
+ [self->_pdfView goToRect:tempZoomRect onPage:pageRef];
811
+ CGPoint defZoomOrigin = [self->_pdfView convertPoint:tempZoomRect.origin fromPage:pageRef];
812
+ defZoomOrigin.x = defZoomOrigin.x - self->_pdfView.frame.size.width / 2;
813
+ defZoomOrigin.y = defZoomOrigin.y - self->_pdfView.frame.size.height / 2;
814
+ defZoomOrigin = [self->_pdfView convertPoint:defZoomOrigin toPage:pageRef];
815
+ CGRect defZoomRect = CGRectOffset(
816
+ tempZoomRect,
817
+ defZoomOrigin.x - tempZoomRect.origin.x,
818
+ defZoomOrigin.y - tempZoomRect.origin.y
819
+ );
820
+ [self->_pdfView goToRect:defZoomRect onPage:pageRef];
821
+
822
+ [self setNeedsDisplay];
823
+ [self onScaleChanged:Nil];
824
+ }];
825
+ });
826
+ }
827
+
828
+ /**
829
+ * Single Tap
830
+ * stop zoom
831
+ *
832
+ * @param recognizer
833
+ */
834
+ - (void)handleSingleTap:(UITapGestureRecognizer *)sender
835
+ {
836
+ //_pdfView.scaleFactor = _pdfView.minScaleFactor;
837
+
838
+ CGPoint point = [sender locationInView:self];
839
+ PDFPage *pdfPage = [_pdfView pageForPoint:point nearest:NO];
840
+ if (pdfPage) {
841
+ unsigned long page = [_pdfDocument indexForPage:pdfPage];
842
+ [self notifyOnChangeWithMessage:
843
+ [[NSString alloc] initWithString:[NSString stringWithFormat:@"pageSingleTap|%lu|%f|%f", page+1, point.x, point.y]]];
844
+ }
845
+
846
+ //[self setNeedsDisplay];
847
+ //[self onScaleChanged:Nil];
848
+
849
+
850
+ }
851
+
852
+ /**
853
+ * Pinch
854
+ *
855
+ *
856
+ * @param recognizer
857
+ */
858
+ -(void)handlePinch:(UIPinchGestureRecognizer *)sender{
859
+ [self onScaleChanged:Nil];
860
+ }
861
+
862
+ /**
863
+ * Do nothing on long Press
864
+ *
865
+ *
866
+ */
867
+ - (void)handleLongPress:(UILongPressGestureRecognizer *)sender{
868
+
869
+ }
870
+
871
+ /**
872
+ * Bind tap
873
+ *
874
+ *
875
+ */
876
+ - (void)bindTap
877
+ {
878
+ UITapGestureRecognizer *doubleTapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self
879
+ action:@selector(handleDoubleTap:)];
880
+ //trigger by one finger and double touch
881
+ doubleTapRecognizer.numberOfTapsRequired = 2;
882
+ doubleTapRecognizer.numberOfTouchesRequired = 1;
883
+ doubleTapRecognizer.delegate = self;
884
+
885
+ [self addGestureRecognizer:doubleTapRecognizer];
886
+ _doubleTapRecognizer = doubleTapRecognizer;
887
+
888
+ UITapGestureRecognizer *singleTapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self
889
+ action:@selector(handleSingleTap:)];
890
+ //trigger by one finger and one touch
891
+ singleTapRecognizer.numberOfTapsRequired = 1;
892
+ singleTapRecognizer.numberOfTouchesRequired = 1;
893
+ singleTapRecognizer.delegate = self;
894
+
895
+ [self addGestureRecognizer:singleTapRecognizer];
896
+ _singleTapRecognizer = singleTapRecognizer;
897
+
898
+ [singleTapRecognizer requireGestureRecognizerToFail:doubleTapRecognizer];
899
+
900
+ UIPinchGestureRecognizer *pinchRecognizer = [[UIPinchGestureRecognizer alloc] initWithTarget:self
901
+ action:@selector(handlePinch:)];
902
+ [self addGestureRecognizer:pinchRecognizer];
903
+ _pinchRecognizer = pinchRecognizer;
904
+
905
+ pinchRecognizer.delegate = self;
906
+
907
+ UILongPressGestureRecognizer *longPressRecognizer = [[UILongPressGestureRecognizer alloc] initWithTarget:self
908
+ action:@selector(handleLongPress:)];
909
+ // Making sure the allowable movement isn not too narrow
910
+ longPressRecognizer.allowableMovement=100;
911
+ // Important: The duration must be long enough to allow taps but not longer than the period in which view opens the magnifying glass
912
+ longPressRecognizer.minimumPressDuration=0.3;
913
+
914
+ [self addGestureRecognizer:longPressRecognizer];
915
+ _longPressRecognizer = longPressRecognizer;
916
+
917
+ // Override the _pdfView double tap gesture recognizer so that it doesn't confilict with custom double tap
918
+ UITapGestureRecognizer *doubleTapEmptyRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self
919
+ action:@selector(handleDoubleTapEmpty:)];
920
+ doubleTapEmptyRecognizer.numberOfTapsRequired = 2;
921
+ [_pdfView addGestureRecognizer:doubleTapEmptyRecognizer];
922
+ _doubleTapEmptyRecognizer = doubleTapEmptyRecognizer;
923
+ }
924
+
925
+ - (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer
926
+
927
+ {
928
+ return !_singlePage;
929
+ }
930
+
931
+ - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
932
+ {
933
+ return !_singlePage;
934
+ }
935
+
936
+ - (void)setScrollIndicators:(UIView *)view horizontal:(BOOL)horizontal vertical:(BOOL)vertical depth:(int)depth {
937
+ // max depth, prevent infinite loop
938
+ if (depth > 10) {
939
+ return;
940
+ }
941
+
942
+ if ([view isKindOfClass:[UIScrollView class]]) {
943
+ UIScrollView *scrollView = (UIScrollView *)view;
944
+ scrollView.showsHorizontalScrollIndicator = horizontal;
945
+ scrollView.showsVerticalScrollIndicator = vertical;
946
+ }
947
+
948
+ for (UIView *subview in view.subviews) {
949
+ [self setScrollIndicators:subview horizontal:horizontal vertical:vertical depth:depth + 1];
950
+ }
951
+ }
952
+
953
+ #pragma mark - Autoscroll
954
+
955
+ - (UIScrollView *)findPdfScrollView
956
+ {
957
+ if (_pdfScrollView) return _pdfScrollView;
958
+ for (UIView *subview in _pdfView.subviews) {
959
+ if ([subview isKindOfClass:[UIScrollView class]]) {
960
+ _pdfScrollView = (UIScrollView *)subview;
961
+ _originalScrollDelegate = _pdfScrollView.delegate;
962
+ _pdfScrollView.delegate = self;
963
+ return _pdfScrollView;
964
+ }
965
+ }
966
+ return nil;
967
+ }
968
+
969
+ - (void)startAutoScroll:(CGFloat)pixels resumeDelay:(NSTimeInterval)resumeDelay
970
+ {
971
+ _autoScrollPixels = pixels; // pixels per second
972
+ _autoScrollResumeDelay = resumeDelay;
973
+ _isAutoScrolling = YES;
974
+
975
+ [self findPdfScrollView];
976
+ [self startDisplayLink];
977
+ }
978
+
979
+ - (void)stopAutoScroll
980
+ {
981
+ _isAutoScrolling = NO;
982
+ [self stopDisplayLink];
983
+ [_autoScrollResumeTimer invalidate];
984
+ _autoScrollResumeTimer = nil;
985
+ }
986
+
987
+ - (void)startDisplayLink
988
+ {
989
+ [_displayLink invalidate];
990
+ _displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(displayLinkTick:)];
991
+ [_displayLink addToRunLoop:[NSRunLoop mainRunLoop] forMode:NSRunLoopCommonModes];
992
+ }
993
+
994
+ - (void)stopDisplayLink
995
+ {
996
+ [_displayLink invalidate];
997
+ _displayLink = nil;
998
+ }
999
+
1000
+ - (void)displayLinkTick:(CADisplayLink *)link
1001
+ {
1002
+ UIScrollView *scrollView = [self findPdfScrollView];
1003
+ if (!scrollView || _isUserDragging) return;
1004
+
1005
+ // Frame-rate-independent: use actual elapsed frame time (e.g. 1/60 or 1/120 on ProMotion)
1006
+ CGFloat frameDuration = (CGFloat)(link.targetTimestamp - link.timestamp);
1007
+ CGFloat pixelsThisFrame = _autoScrollPixels * frameDuration;
1008
+
1009
+ CGFloat maxOffsetY = scrollView.contentSize.height - scrollView.bounds.size.height;
1010
+ if (maxOffsetY <= 0) {
1011
+ [self stopAutoScroll];
1012
+ [self notifyOnChangeWithMessage:@"autoScrollEnd"];
1013
+ return;
1014
+ }
1015
+
1016
+ CGPoint offset = scrollView.contentOffset;
1017
+ CGFloat newY = offset.y + pixelsThisFrame;
1018
+
1019
+ if (newY >= maxOffsetY) {
1020
+ [scrollView setContentOffset:CGPointMake(offset.x, maxOffsetY) animated:NO];
1021
+ [self stopAutoScroll];
1022
+ [self notifyOnChangeWithMessage:@"autoScrollEnd"];
1023
+ return;
1024
+ }
1025
+
1026
+ [scrollView setContentOffset:CGPointMake(offset.x, newY) animated:NO];
1027
+ }
1028
+
1029
+ - (void)scheduleAutoScrollResume
1030
+ {
1031
+ [_autoScrollResumeTimer invalidate];
1032
+ _autoScrollResumeTimer = [NSTimer scheduledTimerWithTimeInterval:_autoScrollResumeDelay
1033
+ target:self
1034
+ selector:@selector(autoScrollResumeFromTimer:)
1035
+ userInfo:nil
1036
+ repeats:NO];
1037
+ }
1038
+
1039
+ - (void)autoScrollResumeFromTimer:(NSTimer *)timer
1040
+ {
1041
+ if (_isAutoScrolling && !_isUserDragging) {
1042
+ [self startDisplayLink];
1043
+ }
1044
+ }
1045
+
1046
+ #pragma mark - UIScrollViewDelegate (autoscroll pause/resume)
1047
+
1048
+ - (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView
1049
+ {
1050
+ _isUserDragging = YES;
1051
+ [self stopDisplayLink];
1052
+ [_autoScrollResumeTimer invalidate];
1053
+ _autoScrollResumeTimer = nil;
1054
+
1055
+ if ([_originalScrollDelegate respondsToSelector:@selector(scrollViewWillBeginDragging:)]) {
1056
+ [_originalScrollDelegate scrollViewWillBeginDragging:scrollView];
1057
+ }
1058
+ }
1059
+
1060
+ - (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate
1061
+ {
1062
+ if (!decelerate) {
1063
+ _isUserDragging = NO;
1064
+ if (_isAutoScrolling) {
1065
+ [self scheduleAutoScrollResume];
1066
+ }
1067
+ }
1068
+
1069
+ if ([_originalScrollDelegate respondsToSelector:@selector(scrollViewDidEndDragging:willDecelerate:)]) {
1070
+ [_originalScrollDelegate scrollViewDidEndDragging:scrollView willDecelerate:decelerate];
1071
+ }
1072
+ }
1073
+
1074
+ - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
1075
+ {
1076
+ _isUserDragging = NO;
1077
+ if (_isAutoScrolling) {
1078
+ [self scheduleAutoScrollResume];
1079
+ }
1080
+
1081
+ if ([_originalScrollDelegate respondsToSelector:@selector(scrollViewDidEndDecelerating:)]) {
1082
+ [_originalScrollDelegate scrollViewDidEndDecelerating:scrollView];
1083
+ }
1084
+ }
1085
+
1086
+ - (void)scrollViewDidScroll:(UIScrollView *)scrollView
1087
+ {
1088
+ if ([_originalScrollDelegate respondsToSelector:@selector(scrollViewDidScroll:)]) {
1089
+ [_originalScrollDelegate scrollViewDidScroll:scrollView];
1090
+ }
1091
+ }
1092
+
1093
+ @end
1094
+
1095
+ #ifdef RCT_NEW_ARCH_ENABLED
1096
+ Class<RCTComponentViewProtocol> RNPDFPdfViewCls(void)
1097
+ {
1098
+ return RNPDFPdfView.class;
1099
+ }
1100
+
1101
+ #endif