@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,125 @@
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
+ 'use strict';
10
+ import React, {Component} from 'react';
11
+ import PropTypes from 'prop-types';
12
+ import {
13
+ View,
14
+ StyleSheet,
15
+ PanResponder
16
+ } from 'react-native';
17
+ import {ViewPropTypes} from 'deprecated-react-native-prop-types';
18
+ export default class PinchZoomView extends Component {
19
+
20
+ static propTypes = {
21
+ ...ViewPropTypes,
22
+ scalable: PropTypes.bool,
23
+ onScaleChanged: PropTypes.func,
24
+ };
25
+
26
+ static defaultProps = {
27
+ scalable: true,
28
+ onScaleChanged: (scale) => {
29
+ },
30
+ };
31
+
32
+ constructor(props) {
33
+
34
+ super(props);
35
+ this.state = {};
36
+ this.distant = 0;
37
+ this.gestureHandlers = PanResponder.create({
38
+ onStartShouldSetPanResponder: this._handleStartShouldSetPanResponder,
39
+ onMoveShouldSetResponderCapture: (evt, gestureState) => (true),
40
+ onMoveShouldSetPanResponder: this._handleMoveShouldSetPanResponder,
41
+ onPanResponderGrant: this._handlePanResponderGrant,
42
+ onPanResponderMove: this._handlePanResponderMove,
43
+ onPanResponderRelease: this._handlePanResponderEnd,
44
+ onPanResponderTerminationRequest: evt => false,
45
+ onPanResponderTerminate: this._handlePanResponderTerminate,
46
+ onShouldBlockNativeResponder: evt => true
47
+ });
48
+
49
+ }
50
+
51
+ _handleStartShouldSetPanResponder = (e, gestureState) => {
52
+
53
+ // don't respond to single touch to avoid shielding click on child components
54
+ return false;
55
+
56
+ };
57
+
58
+ _handleMoveShouldSetPanResponder = (e, gestureState) => {
59
+
60
+ return this.props.scalable && (e.nativeEvent.changedTouches.length >= 2 || gestureState.numberActiveTouches >= 2);
61
+
62
+ };
63
+
64
+ _handlePanResponderGrant = (e, gestureState) => {
65
+
66
+ if (e.nativeEvent.changedTouches.length >= 2 || gestureState.numberActiveTouches >= 2) {
67
+ let dx = Math.abs(e.nativeEvent.touches[0].pageX - e.nativeEvent.touches[1].pageX);
68
+ let dy = Math.abs(e.nativeEvent.touches[0].pageY - e.nativeEvent.touches[1].pageY);
69
+ this.distant = Math.sqrt(dx * dx + dy * dy);
70
+ }
71
+
72
+ };
73
+
74
+ _handlePanResponderEnd = (e, gestureState) => {
75
+
76
+ this.distant = 0;
77
+
78
+ };
79
+
80
+ _handlePanResponderTerminate = (e, gestureState) => {
81
+
82
+ this.distant = 0;
83
+
84
+ };
85
+
86
+ _handlePanResponderMove = (e, gestureState) => {
87
+
88
+ if ((e.nativeEvent.changedTouches.length >= 2 || gestureState.numberActiveTouches >= 2) && this.distant > 100) {
89
+
90
+ let dx = Math.abs(e.nativeEvent.touches[0].pageX - e.nativeEvent.touches[1].pageX);
91
+ let dy = Math.abs(e.nativeEvent.touches[0].pageY - e.nativeEvent.touches[1].pageY);
92
+ let distant = Math.sqrt(dx * dx + dy * dy);
93
+ let scale = (distant / this.distant);
94
+ let pageX = (e.nativeEvent.touches[0].pageX + e.nativeEvent.touches[1].pageX) / 2;
95
+ let pageY = (e.nativeEvent.touches[0].pageY + e.nativeEvent.touches[1].pageY) / 2;
96
+ let pinchInfo = {scale: scale, pageX: pageX, pageY: pageY};
97
+
98
+ this.props.onScaleChanged(pinchInfo);
99
+ this.distant = distant;
100
+
101
+ }
102
+
103
+ };
104
+
105
+ render() {
106
+
107
+ return (
108
+ <View
109
+ {...this.props}
110
+ {...this.gestureHandlers?.panHandlers}
111
+ style={[styles.container, this.props.style]}>
112
+ {this.props.children}
113
+ </View>
114
+ );
115
+
116
+ }
117
+ }
118
+
119
+ const styles = StyleSheet.create({
120
+ container: {
121
+ flex: 1,
122
+ justifyContent: 'center',
123
+ alignItems: 'center'
124
+ }
125
+ });
package/README.md ADDED
@@ -0,0 +1,450 @@
1
+ # react-native-pdf
2
+ [![npm](https://img.shields.io/npm/v/react-native-pdf.svg?style=flat-square)](https://www.npmjs.com/package/react-native-pdf)
3
+
4
+ A react native PDF view component (cross-platform support)
5
+
6
+ ### Feature
7
+
8
+ * read a PDF from url, blob, local file or asset and can cache it.
9
+ * display horizontally or vertically
10
+ * drag and zoom
11
+ * double tap for zoom
12
+ * support password protected pdf
13
+ * jump to a specific page in the pdf
14
+ * auto scroll with configurable speed (ideal for music sheets)
15
+
16
+ ### Supported versions
17
+ We use [`react-native-blob-util`](https://github.com/RonRadtke/react-native-blob-util) to handle file system access in this package,
18
+ So you should install react-native-pdf and react-native-blob-util
19
+
20
+ > The table below shows the supported versions of React Native and react-native-blob-util for different versions of `react-native-pdf`.
21
+
22
+ | React Native | 0.4x - 0.56 | 0.57 | 0.60+ | 0.62+ | 0.62+ |
23
+ | ------------------------- | --------------- | ------- | -------- | -------- | -------- |
24
+ | react-native-pdf | 4.x.x - 5.0.x | 5.0.9+ | 6.0.0+ | 6.2.0+ | 6.4.0+ |
25
+ | react-native-blob-util | | | | | 0.13.7+ |
26
+
27
+
28
+ > 🚨 Expo: This package is not available in the [Expo Go](https://expo.dev/client) app. Learn how you can use this package in [Custom Dev Clients](https://docs.expo.dev/development/getting-started/) via the out-of-tree [Expo Config Plugin](https://github.com/expo/config-plugins/tree/master/packages/react-native-pdf). Example: [`with-pdf`](https://github.com/expo/examples/tree/master/with-pdf).
29
+
30
+ ### Installation
31
+
32
+ ```bash
33
+ # Using npm
34
+ npm install react-native-pdf react-native-blob-util --save
35
+
36
+ # or using yarn:
37
+ yarn add react-native-pdf react-native-blob-util
38
+ ```
39
+
40
+ Then follow the instructions for your platform to link react-native-pdf into your project:
41
+
42
+ ### iOS installation
43
+ <details>
44
+ <summary>iOS details</summary>
45
+
46
+ **React Native 0.60 and above**
47
+
48
+ Run `pod install` in the `ios` directory. Linking is not required in React Native 0.60 and above.
49
+
50
+ **React Native 0.59 and below**
51
+
52
+ ```bash
53
+ react-native link react-native-blob-util
54
+ react-native link react-native-pdf
55
+ ```
56
+ </details>
57
+
58
+ ### Android installation
59
+ <details>
60
+ <summary>Android details</summary>
61
+
62
+ **If you use RN 0.59.0 and above**, please add following to your android/app/build.gradle**
63
+ ```diff
64
+ android {
65
+
66
+ + packagingOptions {
67
+ + pickFirst 'lib/x86/libc++_shared.so'
68
+ + pickFirst 'lib/x86_64/libjsc.so'
69
+ + pickFirst 'lib/arm64-v8a/libjsc.so'
70
+ + pickFirst 'lib/arm64-v8a/libc++_shared.so'
71
+ + pickFirst 'lib/x86_64/libc++_shared.so'
72
+ + pickFirst 'lib/armeabi-v7a/libc++_shared.so'
73
+ + }
74
+
75
+ }
76
+ ```
77
+
78
+ **React Native 0.59.0 and below**
79
+ ```bash
80
+ react-native link react-native-blob-util
81
+ react-native link react-native-pdf
82
+ ```
83
+
84
+
85
+ </details>
86
+
87
+ ### Windows installation
88
+ <details>
89
+ <summary>Windows details</summary>
90
+
91
+ - Open your solution in Visual Studio 2019 (eg. `windows\yourapp.sln`)
92
+ - Right-click Solution icon in Solution Explorer > Add > Existing Project...
93
+ - If running RNW 0.62: add `node_modules\react-native-pdf\windows\RCTPdf\RCTPdf.vcxproj`
94
+ - If running RNW 0.62: add `node_modules\react-native-blob-util\windows\ReactNativeBlobUtil\ReactNativeBlobUtil.vcxproj`
95
+ - Right-click main application project > Add > Reference...
96
+ - Select `progress-view` and in Solution Projects
97
+ - If running 0.62, also select `RCTPdf` and `ReactNativeBlobUtil`
98
+ - In app `pch.h` add `#include "winrt/RCTPdf.h"`
99
+ - If running 0.62, also select `#include "winrt/ReactNativeBlobUtil.h"`
100
+ - In `App.cpp` add `PackageProviders().Append(winrt::progress_view::ReactPackageProvider());` before `InitializeComponent();`
101
+ - If running RNW 0.62, also add `PackageProviders().Append(winrt::RCTPdf::ReactPackageProvider());` and `PackageProviders().Append(winrt::ReactNativeBlobUtil::ReactPackageProvider());`
102
+
103
+
104
+ #### Bundling PDFs with the app
105
+ To add a `test.pdf` like in the example add:
106
+ ```
107
+ <None Include="..\..\test.pdf">
108
+ <DeploymentContent>true</DeploymentContent>
109
+ </None>
110
+ ```
111
+ in the app `.vcxproj` file, before `<None Include="packages.config" />`.
112
+ </details>
113
+
114
+ ### FAQ
115
+ <details>
116
+ <summary>FAQ details</summary>
117
+
118
+ Q1. After installation and running, I can not see the pdf file.
119
+ A1: maybe you forgot to excute ```react-native link``` or it does not run correctly.
120
+ You can add it manually. For detail you can see the issue [`#24`](https://github.com/wonday/react-native-pdf/issues/24) and [`#2`](https://github.com/wonday/react-native-pdf/issues/2)
121
+
122
+ Q2. When running, it shows ```'Pdf' has no propType for native prop RCTPdf.acessibilityLabel of native type 'String'```
123
+ A2. Your react-native version is too old, please upgrade it to 0.47.0+ see also [`#39`](https://github.com/wonday/react-native-pdf/issues/39)
124
+
125
+ Q3. When I run the example app I get a white/gray screen / the loading bar isn't progressing .
126
+ A3. Check your uri, if you hit a pdf that is hosted on a `http` you will need to do the following:
127
+
128
+ **iOS:**
129
+ add an exception for the server hosting the pdf in the ios `info.plist`. Here is an example :
130
+
131
+ ```
132
+ <key>NSAppTransportSecurity</key>
133
+ <dict>
134
+ <key>NSExceptionDomains</key>
135
+ <dict>
136
+ <key>yourserver.com</key>
137
+ <dict>
138
+ <!--Include to allow subdomains-->
139
+ <key>NSIncludesSubdomains</key>
140
+ <true/>
141
+ <!--Include to allow HTTP requests-->
142
+ <key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
143
+ <true/>
144
+ <!--Include to specify minimum TLS version-->
145
+ <key>NSTemporaryExceptionMinimumTLSVersion</key>
146
+ <string>TLSv1.1</string>
147
+ </dict>
148
+ </dict>
149
+ </dict>
150
+ ```
151
+
152
+ **Android:**
153
+ [`see here`](https://stackoverflow.com/questions/54818098/cleartext-http-traffic-not-permitted)
154
+
155
+ Q4. why doesn't it work with react native expo?.
156
+ A4. Expo does not support native module. you can read more expo caveats [`here`](https://facebook.github.io/react-native/docs/getting-started.html#caveats)
157
+
158
+ Q5. Why can't I run the iOS example? `'Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65.'`
159
+ A5. Run the following commands in the project folder (e.g. `react-native-pdf/example`) to ensure that all dependencies are available:
160
+ ```
161
+ yarn install (or npm install)
162
+ cd ios
163
+ pod install
164
+ cd ..
165
+ react-native run-ios
166
+ ```
167
+ </details>
168
+
169
+ ### ChangeLog
170
+ <details>
171
+ <summary>ChangeLog details</summary>
172
+ v7.0.3
173
+ 1. Fixed: RefObject types, and setPage not working in android (#985)
174
+
175
+ v7.0.2
176
+ 1. Fixed: `Loaded page is null` error when `bookmarks` is 0 (#978)
177
+ 2. Feature: agp 7.3+ fully supported (#980)
178
+ 3. Fixed: Downgrade pdfiumandroid version to 1.0.32
179
+
180
+ v7.0.1
181
+ 1. Fixed: not rendering on iOS
182
+ 2. Added: Android 16 KB Page Size support
183
+ 3. Fixed: crash issue in io.legere:pdfiumandroid that occurred due to multithreading
184
+ 4. Added: Upgrade Fabric Example to Latest React Native 0.81.0
185
+ 5. Added: support RTL android
186
+
187
+ v6.7.7
188
+ 1. Added: add support for customizable scroll indicators in PdfView component (#904)
189
+ 2. Fixed: fix field values not being visible on android. issue #864 :bug: (#896)
190
+
191
+ v6.7.6
192
+ 1. Fixed: Add missing 'enableDoubleTapZoom' to fabric codegen source (#832)
193
+ 2. Fixed: added missing 'scrollEnabled' prop (#842)
194
+ 3. Fixed: java.lang.IllegalStateException: Tried to access a JS module before the React instance was fully set up (#840)
195
+ 4. Fixed: an issue that crashes when cancel is not present (#852)
196
+ 5. Added: add load method (#861)
197
+ 6. Fixed: encoded accented character is decoded incorrectly (#873)
198
+ 7. Fixed: enableDoubleTapZoom bugfix
199
+
200
+
201
+ v6.7.5
202
+ 1. Added progressContainerStyle prop
203
+ 2. Improved: Added enableDoubleTapZoom option
204
+ 3. Fixed: Fix app crash with this.lastRNBFTask.cancel is not a function (#827)
205
+ 4. Fixed: Remove override to fix 'no matching methods to override' error (#822)
206
+
207
+ v6.7.4
208
+ 1. Fixed: fix Android crash issue
209
+
210
+ v6.7.3
211
+ 1. Fixed: fix android package name
212
+
213
+ v6.7.2
214
+ 1. Fixed: fix iOS double tap zoom scrolling
215
+ 2. Fixed: fix RN 73 compatibility
216
+ 3. Fixed: bump crypto-js to avoid critical vulnerability
217
+
218
+ v6.7.1
219
+ 1. Fixed: fix ios project setting
220
+ 2. Fixed: fix typo in RNPDFPdfViewManagerInterface interface causing android build error
221
+
222
+ v6.7.0
223
+ 1. Fixed: fix(iOS): center page at tap point after double tap to zoom
224
+ 2. Fixed: add PDFKit to podspec to make ios compile
225
+ 3. Improved: Update build.gradle to support RN 0.71 on new arch
226
+ 4. Fixed: fix some small bugs and documents.
227
+
228
+ v6.6.2
229
+ 1. Fixed: Migrate to ViewPropTypes exported from 'deprecated-react-native-prop-types'
230
+ 2. Added: Decode File Path for iOS
231
+ 3. Improved: prefer current page for calculating scale factor on fit
232
+
233
+ v6.6.1 depresed
234
+
235
+ v6.6.0 depresed
236
+ 1. Fixed: Migrate to ViewPropTypes exported from 'deprecated-react-native-prop-types'
237
+ 2. Added: Decode File Path for iOS
238
+ 3. Improved: prefer current page for calculating scale factor on fit
239
+ 4. Improved: Typescript version source
240
+
241
+ v6.5.0
242
+ 1. Fix: replace mavenCentral with maven
243
+ 2. Breaking Change(Android): replace deprecated repository: jcenter()
244
+ 3. Fix: loading progress
245
+ 4. Add: Typed "source" prop
246
+ 5. Remove: dependency to fbjs
247
+
248
+ v6.4.0
249
+ 1. Remove sample for reducing NPM package size
250
+ 2. Add support for setting a filename for the cached pdf file
251
+ 3. Use react-native-blob-util instead of rn-fetch-blob
252
+ 4. Add blob support
253
+ 5. remove progress-view dependency
254
+
255
+ v6.3.0
256
+ 1. Add windows support
257
+ 2. Fixed some bugs
258
+
259
+ [[more]](https://github.com/wonday/react-native-pdf/releases)
260
+
261
+ </details>
262
+
263
+ ### Example
264
+
265
+ ```js
266
+ /**
267
+ * Copyright (c) 2017-present, Wonday (@wonday.org)
268
+ * All rights reserved.
269
+ *
270
+ * This source code is licensed under the MIT-style license found in the
271
+ * LICENSE file in the root directory of this source tree.
272
+ */
273
+
274
+ import React from 'react';
275
+ import { StyleSheet, Dimensions, View } from 'react-native';
276
+ import Pdf from 'react-native-pdf';
277
+
278
+ export default class PDFExample extends React.Component {
279
+ render() {
280
+ const source = { uri: 'http://samples.leanpub.com/thereactnativebook-sample.pdf', cache: true };
281
+ //const source = require('./test.pdf'); // ios only
282
+ //const source = {uri:'bundle-assets://test.pdf' };
283
+ //const source = {uri:'file:///sdcard/test.pdf'};
284
+ //const source = {uri:"data:application/pdf;base64,JVBERi0xLjcKJc..."};
285
+ //const source = {uri:"content://com.example.blobs/xxxxxxxx-...?offset=0&size=xxx"};
286
+ //const source = {uri:"blob:xxxxxxxx-...?offset=0&size=xxx"};
287
+
288
+ return (
289
+ <View style={styles.container}>
290
+ <Pdf
291
+ source={source}
292
+ onLoadComplete={(numberOfPages,filePath) => {
293
+ console.log(`Number of pages: ${numberOfPages}`);
294
+ }}
295
+ onPageChanged={(page,numberOfPages) => {
296
+ console.log(`Current page: ${page}`);
297
+ }}
298
+ onError={(error) => {
299
+ console.log(error);
300
+ }}
301
+ onPressLink={(uri) => {
302
+ console.log(`Link pressed: ${uri}`);
303
+ }}
304
+ style={styles.pdf}/>
305
+ </View>
306
+ )
307
+ }
308
+ }
309
+
310
+ const styles = StyleSheet.create({
311
+ container: {
312
+ flex: 1,
313
+ justifyContent: 'flex-start',
314
+ alignItems: 'center',
315
+ marginTop: 25,
316
+ },
317
+ pdf: {
318
+ flex:1,
319
+ width:Dimensions.get('window').width,
320
+ height:Dimensions.get('window').height,
321
+ }
322
+ });
323
+
324
+ ```
325
+
326
+
327
+ ### Configuration
328
+
329
+ | Property | Type | Default | Description | iOS | Android | Windows | FirstRelease |
330
+ | ------------------------------ | :-----------------------------------------------------------: | :----------------------: | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --- | ------- | --------------------------- | ------------------------ |
331
+ | source | object | not null | PDF source like {uri:xxx, cache:false}. see the following for detail. | ✔ | ✔ | ✔ | <3.0 |
332
+ | page | number | 1 | initial page index | ✔ | ✔ | ✔ | <3.0 |
333
+ | scale | number | 1.0 | should minScale<=scale<=maxScale | ✔ | ✔ | ✔ | <3.0 |
334
+ | minScale | number | 1.0 | min scale | ✔ | ✔ | ✔ | 5.0.5 |
335
+ | maxScale | number | 3.0 | max scale | ✔ | ✔ | ✔ | 5.0.5 |
336
+ | horizontal | bool | false | draw page direction, if you want to listen the orientation change, you can use [[react-native-orientation-locker]](https://github.com/wonday/react-native-orientation-locker) | ✔ | ✔ | ✔ | <3.0 |
337
+ | showsHorizontalScrollIndicator | bool | true | shows or hides the horizontal scroll bar indicator on iOS | ✔ | | | 6.6 |
338
+ | showsVerticalScrollIndicator | bool | true | shows or hides the vertical scroll bar indicator on iOS | ✔ | | | 6.6 |
339
+ | scrollEnabled | bool | true | enable or disable scroll | ✔ | | | 6.6 |
340
+ | fitWidth | bool | false | if true fit the width of view, can not use fitWidth=true together with scale | ✔ | ✔ | ✔ | <3.0, abandoned from 3.0 |
341
+ | fitPolicy | number | 2 | 0:fit width, 1:fit height, 2:fit both(default) | ✔ | ✔ | ✔ | 3.0 |
342
+ | spacing | number | 10 | the breaker size between pages | ✔ | ✔ | ✔ | <3.0 |
343
+ | password | string | "" | pdf password, if password error, will call OnError() with message "Password required or incorrect password." | ✔ | ✔ | ✔ | <3.0 |
344
+ | style | object | {backgroundColor:"#eee"} | support normal view style, you can use this to set border/spacing color... | ✔ | ✔ | ✔ | <3.0
345
+ | progressContainerStyle | object | {backgroundColor:"#eee"} | support normal view style, you can use this to set border/spacing color... | ✔ | ✔ | ✔ | 6.9.0 |
346
+ | renderActivityIndicator | (progress) => Component | <ProgressBar/> | when loading show it as an indicator, you can use your component | ✔ | ✔ | ✖ | <3.0 |
347
+ | enableAntialiasing | bool | true | improve rendering a little bit on low-res screens, but maybe cause some problem on Android 4.4, so add a switch | ✖ | ✔ | ✖ | <3.0 |
348
+ | enablePaging | bool | false | only show one page in screen | ✔ | ✔ | ✔ | 5.0.1 |
349
+ | enableRTL | bool | false | scroll page as "page3, page2, page1" | ✔ | ✖ | ✔ | 5.0.1 |
350
+ | enableAnnotationRendering | bool | true | enable rendering annotation, notice:iOS only support initial setting,not support realtime changing | ✔ | ✔ | ✖ | 5.0.3 |
351
+ | enableDoubleTapZoom | bool | true | Enable double tap to zoom gesture | ✔ | ✔ | ✖ | 6.8.0 |
352
+ | trustAllCerts | bool | true | Allow connections to servers with self-signed certification | ✔ | ✔ | ✖ | 6.0.? |
353
+ | singlePage | bool | false | Only show first page, useful for thumbnail views | ✔ | ✔ | ✔ | 6.2.1 |
354
+ | onLoadProgress | function(percent) | null | callback when loading, return loading progress (0-1) | ✔ | ✔ | ✖ | <3.0 |
355
+ | onLoadComplete | function(numberOfPages, path, {width, height}, tableContents) | null | callback when pdf load completed, return total page count, pdf local/cache path, {width,height} and table of contents | ✔ | ✔ | ✔ but without tableContents | <3.0 |
356
+ | onPageChanged | function(page,numberOfPages) | null | callback when page changed ,return current page and total page count | ✔ | ✔ | ✔ | <3.0 |
357
+ | onError | function(error) | null | callback when error happened | ✔ | ✔ | ✔ | <3.0 |
358
+ | onPageSingleTap | function(page) | null | callback when page was single tapped | ✔ | ✔ | ✔ | 3.0 |
359
+ | onScaleChanged | function(scale) | null | callback when scale page | ✔ | ✔ | ✔ | 3.0 |
360
+ | onPressLink | function(uri) | null | callback when link tapped | ✔ | ✔ | ✖ | 6.0.0 |
361
+ | onAutoScrollEnd | function() | null | callback when autoscroll reaches the end of the document | ✔ | ✔ | ✖ | 7.1.0 |
362
+
363
+ #### parameters of source
364
+
365
+ | parameter | Description | default | iOS | Android | Windows |
366
+ | ------------ | ----------- | ------- | --- | ------- | ------- |
367
+ | uri | pdf source, see the forllowing for detail.| required | ✔ | ✔ | ✔ |
368
+ | cache | use cache or not | false | ✔ | ✔ | ✖ |
369
+ | cacheFileName | specific file name for cached pdf file | SHA1(uri) result | ✔ | ✔ | ✖ |
370
+ | expiration | cache file expired seconds (0 is not expired) | 0 | ✔ | ✔ | ✖ |
371
+ | method | request method when uri is a url | "GET" | ✔ | ✔ | ✖ |
372
+ | headers | request headers when uri is a url | {} | ✔ | ✔ | ✖ |
373
+
374
+ #### types of source.uri
375
+
376
+ | Usage | Description | iOS | Android | Windows |
377
+ | ------------ | ----------- | --- | ------- | ------- |
378
+ | `{uri:"http://xxx/xxx.pdf"}` | load pdf from a url | ✔ | ✔ | ✔ |
379
+ | `{require("./test.pdf")}` | load pdf relate to js file (do not need add by xcode) | ✔ | ✖ | ✖ |
380
+ | `{uri:"bundle-assets://path/to/xxx.pdf"}` | load pdf from assets, the file should be at android/app/src/main/assets/path/to/xxx.pdf | ✖ | ✔ | ✖ |
381
+ | `{uri:"bundle-assets://xxx.pdf"}` | load pdf from assets, you must add pdf to project by xcode. this does not support folder. | ✔ | ✖ | ✖ |
382
+ | `{uri:"data:application/pdf;base64,JVBERi0xLjcKJc..."}` | load pdf from base64 string | ✔ | ✔ | ✔ |
383
+ | `{uri:"file:///absolute/path/to/xxx.pdf"}` | load pdf from local file system | ✔ | ✔ | ✔ |
384
+ | `{uri:"ms-appx:///xxx.pdf"}}` | load pdf bundled with UWP app | ✖ | ✖ | ✔ |
385
+ | `{uri:"content://com.example.blobs/xxxxxxxx-...?offset=0&size=xxx"}` | load pdf from content URI | ✔* | ✖ | ✖ |
386
+ | `{uri:"blob:xxxxxxxx-...?offset=0&size=xxx"}` | load pdf from blob URL | ✖ | ✔ | ✖ |
387
+
388
+ \*) requires building React Native from source with [this patch](https://github.com/facebook/react-native/pull/31789)
389
+ ### Methods
390
+ * [setPage](#setPage)
391
+ * [startAutoScroll](#startAutoScroll)
392
+ * [stopAutoScroll](#stopAutoScroll)
393
+
394
+ Methods operate on a ref to the PDF element. You can get a ref with the following code:
395
+ ```
396
+ return (
397
+ <Pdf
398
+ ref={(pdf) => { this.pdf = pdf; }}
399
+ source={source}
400
+ ...
401
+ />
402
+ );
403
+ ```
404
+
405
+ #### setPage()
406
+ `setPage(pageNumber)`
407
+
408
+ Set the current page of the PDF component. pageNumber is a positive integer. If pageNumber > numberOfPages, current page is not changed.
409
+
410
+ Example:
411
+ ```
412
+ this.pdf.setPage(42); // Display the answer to the Ultimate Question of Life, the Universe, and Everything
413
+ ```
414
+
415
+ #### startAutoScroll()
416
+ `startAutoScroll(pixels?, resumeDelay?)`
417
+
418
+ Start automatic vertical scrolling. Ideal for hands-free reading of music sheets or long documents.
419
+
420
+ | Parameter | Type | Default | Description |
421
+ | ----------- | ------ | ------- | ----------------------------------------------------- |
422
+ | pixels | number | 15 | Scroll speed in pixels per second |
423
+ | resumeDelay | number | 3000 | Milliseconds to wait before resuming after user touch |
424
+
425
+ The scroll pauses automatically when the user touches the PDF and resumes after `resumeDelay` milliseconds. Scrolling is frame-rate-independent (driven by `CADisplayLink` on iOS, `Choreographer` on Android at the screen's native refresh rate — typically 60 or 120 fps). When the scroll reaches the end of the document it stops and the `onAutoScrollEnd` callback fires.
426
+
427
+ Example (music sheet use case):
428
+ ```js
429
+ // Start slow auto scroll for reading music sheets
430
+ this.pdf.startAutoScroll(10, 3000);
431
+
432
+ // In your component:
433
+ <Pdf
434
+ ref={(pdf) => { this.pdf = pdf; }}
435
+ source={{ uri: 'path/to/music-sheet.pdf' }}
436
+ onAutoScrollEnd={() => {
437
+ console.log('Reached the end of the score');
438
+ }}
439
+ />
440
+ ```
441
+
442
+ #### stopAutoScroll()
443
+ `stopAutoScroll()`
444
+
445
+ Stop the automatic scrolling. The scroll will not resume until `startAutoScroll()` is called again.
446
+
447
+ Example:
448
+ ```
449
+ this.pdf.stopAutoScroll();
450
+ ```
File without changes
@@ -0,0 +1,2 @@
1
+ #Thu Feb 19 11:38:19 CET 2026
2
+ gradle.version=8.5
@@ -0,0 +1,2 @@
1
+ #Thu Feb 19 11:37:37 CET 2026
2
+ java.home=/Applications/Android Studio.app/Contents/jbr/Contents/Home
File without changes
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="AndroidProjectSystem">
4
+ <option name="providerId" value="com.android.tools.idea.GradleProjectSystem" />
5
+ </component>
6
+ </project>