react-native-pdf 6.7.4 → 6.7.6
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.
- package/PdfView.js +1 -0
- package/README.md +48 -30
- package/android/build.gradle +17 -14
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +7 -0
- package/android/gradle.properties +2 -0
- package/android/gradlew +249 -0
- package/android/gradlew.bat +92 -0
- package/android/src/main/AndroidManifest.xml +1 -1
- package/android/src/main/java/org/wonday/pdf/PdfManager.java +10 -0
- package/android/src/main/java/org/wonday/pdf/PdfView.java +119 -62
- package/android/src/main/java/org/wonday/pdf/events/TopChangeEvent.java +26 -0
- package/android/src/paper/java/com/facebook/react/viewmanagers/RNPDFPdfViewManagerDelegate.java +7 -2
- package/android/src/paper/java/com/facebook/react/viewmanagers/RNPDFPdfViewManagerInterface.java +2 -0
- package/fabric/RNPDFPdfNativeComponent.js +3 -1
- package/index.d.ts +10 -1
- package/index.js +7 -5
- package/index.js.flow +2 -0
- package/ios/RNPDFPdf/RNPDFPdfView.h +2 -0
- package/ios/RNPDFPdf/RNPDFPdfView.mm +64 -1
- package/ios/RNPDFPdf/RNPDFPdfViewManager.mm +2 -0
- package/package.json +1 -1
- package/react-native-pdf.podspec +1 -14
package/PdfView.js
CHANGED
package/README.md
CHANGED
|
@@ -168,9 +168,24 @@ react-native run-ios
|
|
|
168
168
|
### ChangeLog
|
|
169
169
|
<details>
|
|
170
170
|
<summary>ChangeLog details</summary>
|
|
171
|
+
v6.7.6
|
|
172
|
+
1. Fixed: Add missing 'enableDoubleTapZoom' to fabric codegen source (#832)
|
|
173
|
+
2. Fixed: added missing 'scrollEnabled' prop (#842)
|
|
174
|
+
3. Fixed: java.lang.IllegalStateException: Tried to access a JS module before the React instance was fully set up (#840)
|
|
175
|
+
4. Fixed: an issue that crashes when cancel is not present (#852)
|
|
176
|
+
5. Added: add load method (#861)
|
|
177
|
+
6. Fixed: encoded accented character is decoded incorrectly (#873)
|
|
178
|
+
7. Fixed: enableDoubleTapZoom bugfix
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
v6.7.5
|
|
182
|
+
1. Added progressContainerStyle prop
|
|
183
|
+
2. Improved: Added enableDoubleTapZoom option
|
|
184
|
+
3. Fixed: Fix app crash with this.lastRNBFTask.cancel is not a function (#827)
|
|
185
|
+
4. Fixed: Remove override to fix 'no matching methods to override' error (#822)
|
|
171
186
|
|
|
172
187
|
v6.7.4
|
|
173
|
-
1. Fixed:
|
|
188
|
+
1. Fixed: fix Android crash issue
|
|
174
189
|
|
|
175
190
|
v6.7.3
|
|
176
191
|
1. Fixed: fix android package name
|
|
@@ -291,35 +306,38 @@ const styles = StyleSheet.create({
|
|
|
291
306
|
|
|
292
307
|
### Configuration
|
|
293
308
|
|
|
294
|
-
| Property
|
|
295
|
-
|
|
|
296
|
-
| source
|
|
297
|
-
| page
|
|
298
|
-
| scale
|
|
299
|
-
| minScale
|
|
300
|
-
| maxScale
|
|
301
|
-
| horizontal
|
|
302
|
-
| showsHorizontalScrollIndicator
|
|
303
|
-
| showsVerticalScrollIndicator
|
|
304
|
-
|
|
|
305
|
-
|
|
|
306
|
-
|
|
|
307
|
-
|
|
|
308
|
-
|
|
|
309
|
-
|
|
|
310
|
-
|
|
|
311
|
-
|
|
|
312
|
-
|
|
|
313
|
-
|
|
|
314
|
-
|
|
|
315
|
-
|
|
|
316
|
-
|
|
|
317
|
-
|
|
|
318
|
-
|
|
|
319
|
-
|
|
|
320
|
-
|
|
|
321
|
-
|
|
|
322
|
-
|
|
|
309
|
+
| Property | Type | Default | Description | iOS | Android | Windows | FirstRelease |
|
|
310
|
+
| ------------------------------ | :-----------------------------------------------------------: | :----------------------: | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --- | ------- | --------------------------- | ------------------------ |
|
|
311
|
+
| source | object | not null | PDF source like {uri:xxx, cache:false}. see the following for detail. | ✔ | ✔ | ✔ | <3.0 |
|
|
312
|
+
| page | number | 1 | initial page index | ✔ | ✔ | ✔ | <3.0 |
|
|
313
|
+
| scale | number | 1.0 | should minScale<=scale<=maxScale | ✔ | ✔ | ✔ | <3.0 |
|
|
314
|
+
| minScale | number | 1.0 | min scale | ✔ | ✔ | ✔ | 5.0.5 |
|
|
315
|
+
| maxScale | number | 3.0 | max scale | ✔ | ✔ | ✔ | 5.0.5 |
|
|
316
|
+
| 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 |
|
|
317
|
+
| showsHorizontalScrollIndicator | bool | true | shows or hides the horizontal scroll bar indicator on iOS | ✔ | | | 6.6 |
|
|
318
|
+
| showsVerticalScrollIndicator | bool | true | shows or hides the vertical scroll bar indicator on iOS | ✔ | | | 6.6 |
|
|
319
|
+
| scrollEnabled | bool | true | enable or disable scroll | ✔ | | | 6.6 |
|
|
320
|
+
| fitWidth | bool | false | if true fit the width of view, can not use fitWidth=true together with scale | ✔ | ✔ | ✔ | <3.0, abandoned from 3.0 |
|
|
321
|
+
| fitPolicy | number | 2 | 0:fit width, 1:fit height, 2:fit both(default) | ✔ | ✔ | ✔ | 3.0 |
|
|
322
|
+
| spacing | number | 10 | the breaker size between pages | ✔ | ✔ | ✔ | <3.0 |
|
|
323
|
+
| password | string | "" | pdf password, if password error, will call OnError() with message "Password required or incorrect password." | ✔ | ✔ | ✔ | <3.0 |
|
|
324
|
+
| style | object | {backgroundColor:"#eee"} | support normal view style, you can use this to set border/spacing color... | ✔ | ✔ | ✔ | <3.0
|
|
325
|
+
| progressContainerStyle | object | {backgroundColor:"#eee"} | support normal view style, you can use this to set border/spacing color... | ✔ | ✔ | ✔ | 6.9.0 |
|
|
326
|
+
| renderActivityIndicator | (progress) => Component | <ProgressBar/> | when loading show it as an indicator, you can use your component | ✔ | ✔ | ✖ | <3.0 |
|
|
327
|
+
| enableAntialiasing | bool | true | improve rendering a little bit on low-res screens, but maybe course some problem on Android 4.4, so add a switch | ✖ | ✔ | ✖ | <3.0 |
|
|
328
|
+
| enablePaging | bool | false | only show one page in screen | ✔ | ✔ | ✔ | 5.0.1 |
|
|
329
|
+
| enableRTL | bool | false | scroll page as "page3, page2, page1" | ✔ | ✖ | ✔ | 5.0.1 |
|
|
330
|
+
| enableAnnotationRendering | bool | true | enable rendering annotation, notice:iOS only support initial setting,not support realtime changing | ✔ | ✔ | ✖ | 5.0.3 |
|
|
331
|
+
| enableDoubleTapZoom | bool | true | Enable double tap to zoom gesture | ✔ | ✔ | ✖ | 6.8.0 |
|
|
332
|
+
| trustAllCerts | bool | true | Allow connections to servers with self-signed certification | ✔ | ✔ | ✖ | 6.0.? |
|
|
333
|
+
| singlePage | bool | false | Only show first page, useful for thumbnail views | ✔ | ✔ | ✔ | 6.2.1 |
|
|
334
|
+
| onLoadProgress | function(percent) | null | callback when loading, return loading progress (0-1) | ✔ | ✔ | ✖ | <3.0 |
|
|
335
|
+
| 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 |
|
|
336
|
+
| onPageChanged | function(page,numberOfPages) | null | callback when page changed ,return current page and total page count | ✔ | ✔ | ✔ | <3.0 |
|
|
337
|
+
| onError | function(error) | null | callback when error happened | ✔ | ✔ | ✔ | <3.0 |
|
|
338
|
+
| onPageSingleTap | function(page) | null | callback when page was single tapped | ✔ | ✔ | ✔ | 3.0 |
|
|
339
|
+
| onScaleChanged | function(scale) | null | callback when scale page | ✔ | ✔ | ✔ | 3.0 |
|
|
340
|
+
| onPressLink | function(uri) | null | callback when link tapped | ✔ | ✔ | ✖ | 6.0.0 |
|
|
323
341
|
|
|
324
342
|
#### parameters of source
|
|
325
343
|
|
package/android/build.gradle
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
description = 'react-native-pdf'
|
|
2
2
|
|
|
3
3
|
buildscript {
|
|
4
|
-
ext.safeExtGet = {prop, fallback ->
|
|
4
|
+
ext.safeExtGet = { prop, fallback ->
|
|
5
5
|
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
|
|
6
6
|
}
|
|
7
7
|
repositories {
|
|
@@ -10,7 +10,7 @@ buildscript {
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
dependencies {
|
|
13
|
-
classpath("com.android.tools.build:gradle:7.2
|
|
13
|
+
classpath("com.android.tools.build:gradle:7.4.2")
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
|
|
@@ -21,10 +21,11 @@ repositories {
|
|
|
21
21
|
url "$projectDir/../node_modules/react-native/android"
|
|
22
22
|
content {
|
|
23
23
|
// Use Jitpack only for AndroidPdfViewer; the rest is hosted at mavenCentral.
|
|
24
|
-
includeGroup "com.github.
|
|
24
|
+
includeGroup "com.github.zacharee"
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
maven { url 'https://jitpack.io' }
|
|
28
|
+
google()
|
|
28
29
|
}
|
|
29
30
|
|
|
30
31
|
apply plugin: 'com.android.library'
|
|
@@ -48,9 +49,9 @@ def resolveReactNativeDirectory() {
|
|
|
48
49
|
}
|
|
49
50
|
|
|
50
51
|
throw new Exception(
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
"[react-native-pdf] Unable to resolve react-native location in " +
|
|
53
|
+
"node_modules. You should add project extension property (in app/build.gradle) " +
|
|
54
|
+
"`REACT_NATIVE_NODE_MODULES_DIR` with path to react-native."
|
|
54
55
|
)
|
|
55
56
|
}
|
|
56
57
|
|
|
@@ -106,12 +107,12 @@ android {
|
|
|
106
107
|
}
|
|
107
108
|
|
|
108
109
|
packagingOptions {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
110
|
+
pickFirst 'lib/x86/libc++_shared.so'
|
|
111
|
+
pickFirst 'lib/x86_64/libjsc.so'
|
|
112
|
+
pickFirst 'lib/x86_64/libc++_shared.so'
|
|
113
|
+
pickFirst 'lib/arm64-v8a/libjsc.so'
|
|
114
|
+
pickFirst 'lib/arm64-v8a/libc++_shared.so'
|
|
115
|
+
pickFirst 'lib/armeabi-v7a/libc++_shared.so'
|
|
115
116
|
}
|
|
116
117
|
}
|
|
117
118
|
|
|
@@ -122,7 +123,9 @@ dependencies {
|
|
|
122
123
|
implementation 'com.facebook.react:react-native:+'
|
|
123
124
|
}
|
|
124
125
|
// NOTE: The original repo at com.github.barteksc is abandoned by the maintainer; there will be no more updates coming from that repo.
|
|
125
|
-
//
|
|
126
|
-
implementation 'com.github.
|
|
126
|
+
// The repo from zacharee is based on PdfiumAndroidKt, a much newer fork of PdfiumAndroid, with better maintenance and updated native libraries.
|
|
127
|
+
implementation 'com.github.zacharee:AndroidPdfViewer:4.0.1'
|
|
128
|
+
// Depend on PdfiumAndroidKt directly so this can be updated independently of AndroidPdfViewer as updates are provided.
|
|
129
|
+
implementation 'io.legere:pdfiumandroid:1.0.19'
|
|
127
130
|
implementation 'com.google.code.gson:gson:2.8.5'
|
|
128
131
|
}
|
|
Binary file
|
package/android/gradlew
ADDED
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
|
|
3
|
+
#
|
|
4
|
+
# Copyright © 2015-2021 the original authors.
|
|
5
|
+
#
|
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
# you may not use this file except in compliance with the License.
|
|
8
|
+
# You may obtain a copy of the License at
|
|
9
|
+
#
|
|
10
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
#
|
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
# See the License for the specific language governing permissions and
|
|
16
|
+
# limitations under the License.
|
|
17
|
+
#
|
|
18
|
+
|
|
19
|
+
##############################################################################
|
|
20
|
+
#
|
|
21
|
+
# Gradle start up script for POSIX generated by Gradle.
|
|
22
|
+
#
|
|
23
|
+
# Important for running:
|
|
24
|
+
#
|
|
25
|
+
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
|
26
|
+
# noncompliant, but you have some other compliant shell such as ksh or
|
|
27
|
+
# bash, then to run this script, type that shell name before the whole
|
|
28
|
+
# command line, like:
|
|
29
|
+
#
|
|
30
|
+
# ksh Gradle
|
|
31
|
+
#
|
|
32
|
+
# Busybox and similar reduced shells will NOT work, because this script
|
|
33
|
+
# requires all of these POSIX shell features:
|
|
34
|
+
# * functions;
|
|
35
|
+
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
|
36
|
+
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
|
37
|
+
# * compound commands having a testable exit status, especially «case»;
|
|
38
|
+
# * various built-in commands including «command», «set», and «ulimit».
|
|
39
|
+
#
|
|
40
|
+
# Important for patching:
|
|
41
|
+
#
|
|
42
|
+
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
|
43
|
+
# by Bash, Ksh, etc; in particular arrays are avoided.
|
|
44
|
+
#
|
|
45
|
+
# The "traditional" practice of packing multiple parameters into a
|
|
46
|
+
# space-separated string is a well documented source of bugs and security
|
|
47
|
+
# problems, so this is (mostly) avoided, by progressively accumulating
|
|
48
|
+
# options in "$@", and eventually passing that to Java.
|
|
49
|
+
#
|
|
50
|
+
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
|
51
|
+
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
|
52
|
+
# see the in-line comments for details.
|
|
53
|
+
#
|
|
54
|
+
# There are tweaks for specific operating systems such as AIX, CygWin,
|
|
55
|
+
# Darwin, MinGW, and NonStop.
|
|
56
|
+
#
|
|
57
|
+
# (3) This script is generated from the Groovy template
|
|
58
|
+
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
|
59
|
+
# within the Gradle project.
|
|
60
|
+
#
|
|
61
|
+
# You can find Gradle at https://github.com/gradle/gradle/.
|
|
62
|
+
#
|
|
63
|
+
##############################################################################
|
|
64
|
+
|
|
65
|
+
# Attempt to set APP_HOME
|
|
66
|
+
|
|
67
|
+
# Resolve links: $0 may be a link
|
|
68
|
+
app_path=$0
|
|
69
|
+
|
|
70
|
+
# Need this for daisy-chained symlinks.
|
|
71
|
+
while
|
|
72
|
+
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
|
73
|
+
[ -h "$app_path" ]
|
|
74
|
+
do
|
|
75
|
+
ls=$( ls -ld "$app_path" )
|
|
76
|
+
link=${ls#*' -> '}
|
|
77
|
+
case $link in #(
|
|
78
|
+
/*) app_path=$link ;; #(
|
|
79
|
+
*) app_path=$APP_HOME$link ;;
|
|
80
|
+
esac
|
|
81
|
+
done
|
|
82
|
+
|
|
83
|
+
# This is normally unused
|
|
84
|
+
# shellcheck disable=SC2034
|
|
85
|
+
APP_BASE_NAME=${0##*/}
|
|
86
|
+
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
|
87
|
+
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
|
|
88
|
+
|
|
89
|
+
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
|
90
|
+
MAX_FD=maximum
|
|
91
|
+
|
|
92
|
+
warn () {
|
|
93
|
+
echo "$*"
|
|
94
|
+
} >&2
|
|
95
|
+
|
|
96
|
+
die () {
|
|
97
|
+
echo
|
|
98
|
+
echo "$*"
|
|
99
|
+
echo
|
|
100
|
+
exit 1
|
|
101
|
+
} >&2
|
|
102
|
+
|
|
103
|
+
# OS specific support (must be 'true' or 'false').
|
|
104
|
+
cygwin=false
|
|
105
|
+
msys=false
|
|
106
|
+
darwin=false
|
|
107
|
+
nonstop=false
|
|
108
|
+
case "$( uname )" in #(
|
|
109
|
+
CYGWIN* ) cygwin=true ;; #(
|
|
110
|
+
Darwin* ) darwin=true ;; #(
|
|
111
|
+
MSYS* | MINGW* ) msys=true ;; #(
|
|
112
|
+
NONSTOP* ) nonstop=true ;;
|
|
113
|
+
esac
|
|
114
|
+
|
|
115
|
+
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
# Determine the Java command to use to start the JVM.
|
|
119
|
+
if [ -n "$JAVA_HOME" ] ; then
|
|
120
|
+
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
|
121
|
+
# IBM's JDK on AIX uses strange locations for the executables
|
|
122
|
+
JAVACMD=$JAVA_HOME/jre/sh/java
|
|
123
|
+
else
|
|
124
|
+
JAVACMD=$JAVA_HOME/bin/java
|
|
125
|
+
fi
|
|
126
|
+
if [ ! -x "$JAVACMD" ] ; then
|
|
127
|
+
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
|
128
|
+
|
|
129
|
+
Please set the JAVA_HOME variable in your environment to match the
|
|
130
|
+
location of your Java installation."
|
|
131
|
+
fi
|
|
132
|
+
else
|
|
133
|
+
JAVACMD=java
|
|
134
|
+
if ! command -v java >/dev/null 2>&1
|
|
135
|
+
then
|
|
136
|
+
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
|
137
|
+
|
|
138
|
+
Please set the JAVA_HOME variable in your environment to match the
|
|
139
|
+
location of your Java installation."
|
|
140
|
+
fi
|
|
141
|
+
fi
|
|
142
|
+
|
|
143
|
+
# Increase the maximum file descriptors if we can.
|
|
144
|
+
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
|
145
|
+
case $MAX_FD in #(
|
|
146
|
+
max*)
|
|
147
|
+
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
|
148
|
+
# shellcheck disable=SC2039,SC3045
|
|
149
|
+
MAX_FD=$( ulimit -H -n ) ||
|
|
150
|
+
warn "Could not query maximum file descriptor limit"
|
|
151
|
+
esac
|
|
152
|
+
case $MAX_FD in #(
|
|
153
|
+
'' | soft) :;; #(
|
|
154
|
+
*)
|
|
155
|
+
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
|
156
|
+
# shellcheck disable=SC2039,SC3045
|
|
157
|
+
ulimit -n "$MAX_FD" ||
|
|
158
|
+
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
|
159
|
+
esac
|
|
160
|
+
fi
|
|
161
|
+
|
|
162
|
+
# Collect all arguments for the java command, stacking in reverse order:
|
|
163
|
+
# * args from the command line
|
|
164
|
+
# * the main class name
|
|
165
|
+
# * -classpath
|
|
166
|
+
# * -D...appname settings
|
|
167
|
+
# * --module-path (only if needed)
|
|
168
|
+
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
|
169
|
+
|
|
170
|
+
# For Cygwin or MSYS, switch paths to Windows format before running java
|
|
171
|
+
if "$cygwin" || "$msys" ; then
|
|
172
|
+
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
|
173
|
+
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
|
174
|
+
|
|
175
|
+
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
|
176
|
+
|
|
177
|
+
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
|
178
|
+
for arg do
|
|
179
|
+
if
|
|
180
|
+
case $arg in #(
|
|
181
|
+
-*) false ;; # don't mess with options #(
|
|
182
|
+
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
|
183
|
+
[ -e "$t" ] ;; #(
|
|
184
|
+
*) false ;;
|
|
185
|
+
esac
|
|
186
|
+
then
|
|
187
|
+
arg=$( cygpath --path --ignore --mixed "$arg" )
|
|
188
|
+
fi
|
|
189
|
+
# Roll the args list around exactly as many times as the number of
|
|
190
|
+
# args, so each arg winds up back in the position where it started, but
|
|
191
|
+
# possibly modified.
|
|
192
|
+
#
|
|
193
|
+
# NB: a `for` loop captures its iteration list before it begins, so
|
|
194
|
+
# changing the positional parameters here affects neither the number of
|
|
195
|
+
# iterations, nor the values presented in `arg`.
|
|
196
|
+
shift # remove old arg
|
|
197
|
+
set -- "$@" "$arg" # push replacement arg
|
|
198
|
+
done
|
|
199
|
+
fi
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
|
203
|
+
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
|
204
|
+
|
|
205
|
+
# Collect all arguments for the java command:
|
|
206
|
+
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
|
207
|
+
# and any embedded shellness will be escaped.
|
|
208
|
+
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
|
209
|
+
# treated as '${Hostname}' itself on the command line.
|
|
210
|
+
|
|
211
|
+
set -- \
|
|
212
|
+
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
|
213
|
+
-classpath "$CLASSPATH" \
|
|
214
|
+
org.gradle.wrapper.GradleWrapperMain \
|
|
215
|
+
"$@"
|
|
216
|
+
|
|
217
|
+
# Stop when "xargs" is not available.
|
|
218
|
+
if ! command -v xargs >/dev/null 2>&1
|
|
219
|
+
then
|
|
220
|
+
die "xargs is not available"
|
|
221
|
+
fi
|
|
222
|
+
|
|
223
|
+
# Use "xargs" to parse quoted args.
|
|
224
|
+
#
|
|
225
|
+
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
|
226
|
+
#
|
|
227
|
+
# In Bash we could simply go:
|
|
228
|
+
#
|
|
229
|
+
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
|
230
|
+
# set -- "${ARGS[@]}" "$@"
|
|
231
|
+
#
|
|
232
|
+
# but POSIX shell has neither arrays nor command substitution, so instead we
|
|
233
|
+
# post-process each arg (as a line of input to sed) to backslash-escape any
|
|
234
|
+
# character that might be a shell metacharacter, then use eval to reverse
|
|
235
|
+
# that process (while maintaining the separation between arguments), and wrap
|
|
236
|
+
# the whole thing up as a single "set" statement.
|
|
237
|
+
#
|
|
238
|
+
# This will of course break if any of these variables contains a newline or
|
|
239
|
+
# an unmatched quote.
|
|
240
|
+
#
|
|
241
|
+
|
|
242
|
+
eval "set -- $(
|
|
243
|
+
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
|
244
|
+
xargs -n1 |
|
|
245
|
+
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
|
246
|
+
tr '\n' ' '
|
|
247
|
+
)" '"$@"'
|
|
248
|
+
|
|
249
|
+
exec "$JAVACMD" "$@"
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
@rem
|
|
2
|
+
@rem Copyright 2015 the original author or authors.
|
|
3
|
+
@rem
|
|
4
|
+
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
@rem you may not use this file except in compliance with the License.
|
|
6
|
+
@rem You may obtain a copy of the License at
|
|
7
|
+
@rem
|
|
8
|
+
@rem https://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
@rem
|
|
10
|
+
@rem Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
@rem See the License for the specific language governing permissions and
|
|
14
|
+
@rem limitations under the License.
|
|
15
|
+
@rem
|
|
16
|
+
|
|
17
|
+
@if "%DEBUG%"=="" @echo off
|
|
18
|
+
@rem ##########################################################################
|
|
19
|
+
@rem
|
|
20
|
+
@rem Gradle startup script for Windows
|
|
21
|
+
@rem
|
|
22
|
+
@rem ##########################################################################
|
|
23
|
+
|
|
24
|
+
@rem Set local scope for the variables with windows NT shell
|
|
25
|
+
if "%OS%"=="Windows_NT" setlocal
|
|
26
|
+
|
|
27
|
+
set DIRNAME=%~dp0
|
|
28
|
+
if "%DIRNAME%"=="" set DIRNAME=.
|
|
29
|
+
@rem This is normally unused
|
|
30
|
+
set APP_BASE_NAME=%~n0
|
|
31
|
+
set APP_HOME=%DIRNAME%
|
|
32
|
+
|
|
33
|
+
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
|
34
|
+
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
|
35
|
+
|
|
36
|
+
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
|
37
|
+
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
|
38
|
+
|
|
39
|
+
@rem Find java.exe
|
|
40
|
+
if defined JAVA_HOME goto findJavaFromJavaHome
|
|
41
|
+
|
|
42
|
+
set JAVA_EXE=java.exe
|
|
43
|
+
%JAVA_EXE% -version >NUL 2>&1
|
|
44
|
+
if %ERRORLEVEL% equ 0 goto execute
|
|
45
|
+
|
|
46
|
+
echo.
|
|
47
|
+
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
|
48
|
+
echo.
|
|
49
|
+
echo Please set the JAVA_HOME variable in your environment to match the
|
|
50
|
+
echo location of your Java installation.
|
|
51
|
+
|
|
52
|
+
goto fail
|
|
53
|
+
|
|
54
|
+
:findJavaFromJavaHome
|
|
55
|
+
set JAVA_HOME=%JAVA_HOME:"=%
|
|
56
|
+
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
|
57
|
+
|
|
58
|
+
if exist "%JAVA_EXE%" goto execute
|
|
59
|
+
|
|
60
|
+
echo.
|
|
61
|
+
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
|
62
|
+
echo.
|
|
63
|
+
echo Please set the JAVA_HOME variable in your environment to match the
|
|
64
|
+
echo location of your Java installation.
|
|
65
|
+
|
|
66
|
+
goto fail
|
|
67
|
+
|
|
68
|
+
:execute
|
|
69
|
+
@rem Setup the command line
|
|
70
|
+
|
|
71
|
+
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
@rem Execute Gradle
|
|
75
|
+
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
|
76
|
+
|
|
77
|
+
:end
|
|
78
|
+
@rem End local scope for the variables with windows NT shell
|
|
79
|
+
if %ERRORLEVEL% equ 0 goto mainEnd
|
|
80
|
+
|
|
81
|
+
:fail
|
|
82
|
+
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
|
83
|
+
rem the _cmd.exe /c_ return code!
|
|
84
|
+
set EXIT_CODE=%ERRORLEVEL%
|
|
85
|
+
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
|
86
|
+
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
|
87
|
+
exit /b %EXIT_CODE%
|
|
88
|
+
|
|
89
|
+
:mainEnd
|
|
90
|
+
if "%OS%"=="Windows_NT" endlocal
|
|
91
|
+
|
|
92
|
+
:omega
|
|
@@ -104,6 +104,11 @@ public class PdfManager extends SimpleViewManager<PdfView> implements RNPDFPdfVi
|
|
|
104
104
|
// NOOP on Android
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
+
@ReactProp(name = "scrollEnabled")
|
|
108
|
+
public void setScrollEnabled(PdfView view, boolean scrollEnabled) {
|
|
109
|
+
pdfView.setScrollEnabled(scrollEnabled);
|
|
110
|
+
}
|
|
111
|
+
|
|
107
112
|
@ReactProp(name = "spacing")
|
|
108
113
|
public void setSpacing(PdfView pdfView, int spacing) {
|
|
109
114
|
pdfView.setSpacing(spacing);
|
|
@@ -124,6 +129,11 @@ public class PdfManager extends SimpleViewManager<PdfView> implements RNPDFPdfVi
|
|
|
124
129
|
pdfView.setEnableAnnotationRendering(enableAnnotationRendering);
|
|
125
130
|
}
|
|
126
131
|
|
|
132
|
+
@ReactProp(name = "enableDoubleTapZoom")
|
|
133
|
+
public void setEnableDoubleTapZoom(PdfView pdfView, boolean enableDoubleTap) {
|
|
134
|
+
pdfView.setEnableDoubleTapZoom(enableDoubleTap);
|
|
135
|
+
}
|
|
136
|
+
|
|
127
137
|
@ReactProp(name = "enablePaging")
|
|
128
138
|
public void setEnablePaging(PdfView pdfView, boolean enablePaging) {
|
|
129
139
|
pdfView.setEnablePaging(enablePaging);
|
|
@@ -12,22 +12,22 @@ import java.io.File;
|
|
|
12
12
|
|
|
13
13
|
import android.content.ContentResolver;
|
|
14
14
|
import android.content.Context;
|
|
15
|
+
import android.util.SizeF;
|
|
15
16
|
import android.view.View;
|
|
16
17
|
import android.view.ViewGroup;
|
|
17
18
|
import android.util.Log;
|
|
18
|
-
import android.graphics.PointF;
|
|
19
19
|
import android.net.Uri;
|
|
20
20
|
import android.util.AttributeSet;
|
|
21
21
|
import android.view.MotionEvent;
|
|
22
22
|
import android.graphics.Canvas;
|
|
23
|
-
import javax.annotation.Nullable;
|
|
24
23
|
|
|
25
24
|
|
|
25
|
+
import com.facebook.react.uimanager.ThemedReactContext;
|
|
26
|
+
import com.facebook.react.uimanager.UIManagerHelper;
|
|
26
27
|
import com.github.barteksc.pdfviewer.PDFView;
|
|
27
28
|
import com.github.barteksc.pdfviewer.listener.OnPageChangeListener;
|
|
28
29
|
import com.github.barteksc.pdfviewer.listener.OnLoadCompleteListener;
|
|
29
30
|
import com.github.barteksc.pdfviewer.listener.OnErrorListener;
|
|
30
|
-
import com.github.barteksc.pdfviewer.listener.OnRenderListener;
|
|
31
31
|
import com.github.barteksc.pdfviewer.listener.OnTapListener;
|
|
32
32
|
import com.github.barteksc.pdfviewer.listener.OnDrawListener;
|
|
33
33
|
import com.github.barteksc.pdfviewer.listener.OnPageScrollListener;
|
|
@@ -36,43 +36,37 @@ import com.github.barteksc.pdfviewer.util.Constants;
|
|
|
36
36
|
import com.github.barteksc.pdfviewer.link.LinkHandler;
|
|
37
37
|
import com.github.barteksc.pdfviewer.model.LinkTapEvent;
|
|
38
38
|
|
|
39
|
-
import com.facebook.react.bridge.NativeModule;
|
|
40
39
|
import com.facebook.react.bridge.ReactContext;
|
|
41
40
|
import com.facebook.react.bridge.Arguments;
|
|
42
41
|
import com.facebook.react.bridge.WritableMap;
|
|
43
|
-
import com.facebook.react.
|
|
44
|
-
import com.facebook.react.uimanager.
|
|
45
|
-
import com.facebook.react.uimanager.
|
|
42
|
+
import com.facebook.react.bridge.ReactContext;
|
|
43
|
+
import com.facebook.react.uimanager.UIManagerModule;
|
|
44
|
+
import com.facebook.react.uimanager.events.EventDispatcher;
|
|
45
|
+
import com.facebook.react.uimanager.events.Event;
|
|
46
46
|
import com.facebook.react.uimanager.events.RCTEventEmitter;
|
|
47
|
-
|
|
48
|
-
import com.facebook.react.modules.core.DeviceEventManagerModule;
|
|
49
|
-
import com.facebook.common.logging.FLog;
|
|
50
|
-
import com.facebook.react.common.ReactConstants;
|
|
47
|
+
|
|
51
48
|
|
|
52
49
|
import static java.lang.String.format;
|
|
53
50
|
|
|
54
51
|
import java.io.FileNotFoundException;
|
|
55
52
|
import java.io.InputStream;
|
|
56
|
-
import java.lang.ClassCastException;
|
|
57
53
|
|
|
58
|
-
import com.shockwave.pdfium.PdfDocument;
|
|
59
54
|
import com.google.gson.Gson;
|
|
60
|
-
|
|
61
|
-
import
|
|
55
|
+
|
|
56
|
+
import org.wonday.pdf.events.TopChangeEvent;
|
|
62
57
|
|
|
63
58
|
public class PdfView extends PDFView implements OnPageChangeListener,OnLoadCompleteListener,OnErrorListener,OnTapListener,OnDrawListener,OnPageScrollListener, LinkHandler {
|
|
64
|
-
private ThemedReactContext context;
|
|
65
59
|
private int page = 1; // start from 1
|
|
66
60
|
private boolean horizontal = false;
|
|
67
61
|
private float scale = 1;
|
|
68
62
|
private float minScale = 1;
|
|
69
63
|
private float maxScale = 3;
|
|
70
|
-
private String asset;
|
|
71
64
|
private String path;
|
|
72
65
|
private int spacing = 10;
|
|
73
66
|
private String password = "";
|
|
74
67
|
private boolean enableAntialiasing = true;
|
|
75
68
|
private boolean enableAnnotationRendering = true;
|
|
69
|
+
private boolean enableDoubleTapZoom = true;
|
|
76
70
|
|
|
77
71
|
private boolean enablePaging = false;
|
|
78
72
|
private boolean autoSpacing = false;
|
|
@@ -80,8 +74,7 @@ public class PdfView extends PDFView implements OnPageChangeListener,OnLoadCompl
|
|
|
80
74
|
private boolean pageSnap = false;
|
|
81
75
|
private FitPolicy fitPolicy = FitPolicy.WIDTH;
|
|
82
76
|
private boolean singlePage = false;
|
|
83
|
-
|
|
84
|
-
private static PdfView instance = null;
|
|
77
|
+
private boolean scrollEnabled = true;
|
|
85
78
|
|
|
86
79
|
private float originalWidth = 0;
|
|
87
80
|
private float lastPageWidth = 0;
|
|
@@ -91,10 +84,8 @@ public class PdfView extends PDFView implements OnPageChangeListener,OnLoadCompl
|
|
|
91
84
|
private int oldW = 0;
|
|
92
85
|
private int oldH = 0;
|
|
93
86
|
|
|
94
|
-
public PdfView(
|
|
95
|
-
super(context,set);
|
|
96
|
-
this.context = context;
|
|
97
|
-
this.instance = this;
|
|
87
|
+
public PdfView(Context context, AttributeSet set){
|
|
88
|
+
super(context, set);
|
|
98
89
|
}
|
|
99
90
|
|
|
100
91
|
@Override
|
|
@@ -106,12 +97,23 @@ public class PdfView extends PDFView implements OnPageChangeListener,OnLoadCompl
|
|
|
106
97
|
|
|
107
98
|
WritableMap event = Arguments.createMap();
|
|
108
99
|
event.putString("message", "pageChanged|"+page+"|"+numberOfPages);
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
100
|
+
|
|
101
|
+
ThemedReactContext context = (ThemedReactContext) getContext();
|
|
102
|
+
EventDispatcher dispatcher = UIManagerHelper.getEventDispatcherForReactTag(context, getId());
|
|
103
|
+
int surfaceId = UIManagerHelper.getSurfaceId(this);
|
|
104
|
+
|
|
105
|
+
TopChangeEvent tce = new TopChangeEvent(surfaceId, getId(), event);
|
|
106
|
+
|
|
107
|
+
if (dispatcher != null) {
|
|
108
|
+
dispatcher.dispatchEvent(tce);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// ReactContext reactContext = (ReactContext)this.getContext();
|
|
112
|
+
// reactContext.getJSModule(RCTEventEmitter.class).receiveEvent(
|
|
113
|
+
// this.getId(),
|
|
114
|
+
// "topChange",
|
|
115
|
+
// event
|
|
116
|
+
// );
|
|
115
117
|
}
|
|
116
118
|
|
|
117
119
|
// In some cases Yoga (I think) will measure the view only along one axis first, resulting in
|
|
@@ -147,12 +149,22 @@ public class PdfView extends PDFView implements OnPageChangeListener,OnLoadCompl
|
|
|
147
149
|
//create a new json Object for the TableOfContents
|
|
148
150
|
Gson gson = new Gson();
|
|
149
151
|
event.putString("message", "loadComplete|"+numberOfPages+"|"+width+"|"+height+"|"+gson.toJson(this.getTableOfContents()));
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
152
|
+
|
|
153
|
+
ThemedReactContext context = (ThemedReactContext) getContext();
|
|
154
|
+
EventDispatcher dispatcher = UIManagerHelper.getEventDispatcherForReactTag(context, getId());
|
|
155
|
+
int surfaceId = UIManagerHelper.getSurfaceId(this);
|
|
156
|
+
|
|
157
|
+
TopChangeEvent tce = new TopChangeEvent(surfaceId, getId(), event);
|
|
158
|
+
|
|
159
|
+
if (dispatcher != null) {
|
|
160
|
+
dispatcher.dispatchEvent(tce);
|
|
161
|
+
}
|
|
162
|
+
// ReactContext reactContext = (ReactContext)this.getContext();
|
|
163
|
+
// reactContext.getJSModule(RCTEventEmitter.class).receiveEvent(
|
|
164
|
+
// this.getId(),
|
|
165
|
+
// "topChange",
|
|
166
|
+
// event
|
|
167
|
+
// );
|
|
156
168
|
|
|
157
169
|
//Log.e("ReactNative", gson.toJson(this.getTableOfContents()));
|
|
158
170
|
|
|
@@ -167,12 +179,22 @@ public class PdfView extends PDFView implements OnPageChangeListener,OnLoadCompl
|
|
|
167
179
|
event.putString("message", "error|"+t.getMessage());
|
|
168
180
|
}
|
|
169
181
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
182
|
+
ThemedReactContext context = (ThemedReactContext) getContext();
|
|
183
|
+
EventDispatcher dispatcher = UIManagerHelper.getEventDispatcherForReactTag(context, getId());
|
|
184
|
+
int surfaceId = UIManagerHelper.getSurfaceId(this);
|
|
185
|
+
|
|
186
|
+
TopChangeEvent tce = new TopChangeEvent(surfaceId, getId(), event);
|
|
187
|
+
|
|
188
|
+
if (dispatcher != null) {
|
|
189
|
+
dispatcher.dispatchEvent(tce);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
// ReactContext reactContext = (ReactContext)this.getContext();
|
|
193
|
+
// reactContext.getJSModule(RCTEventEmitter.class).receiveEvent(
|
|
194
|
+
// this.getId(),
|
|
195
|
+
// "topChange",
|
|
196
|
+
// event
|
|
197
|
+
// );
|
|
176
198
|
}
|
|
177
199
|
|
|
178
200
|
@Override
|
|
@@ -194,12 +216,21 @@ public class PdfView extends PDFView implements OnPageChangeListener,OnLoadCompl
|
|
|
194
216
|
WritableMap event = Arguments.createMap();
|
|
195
217
|
event.putString("message", "pageSingleTap|"+page+"|"+e.getX()+"|"+e.getY());
|
|
196
218
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
219
|
+
ThemedReactContext context = (ThemedReactContext) getContext();
|
|
220
|
+
EventDispatcher dispatcher = UIManagerHelper.getEventDispatcherForReactTag(context, getId());
|
|
221
|
+
int surfaceId = UIManagerHelper.getSurfaceId(this);
|
|
222
|
+
|
|
223
|
+
TopChangeEvent tce = new TopChangeEvent(surfaceId, getId(), event);
|
|
224
|
+
|
|
225
|
+
if (dispatcher != null) {
|
|
226
|
+
dispatcher.dispatchEvent(tce);
|
|
227
|
+
}
|
|
228
|
+
// ReactContext reactContext = (ReactContext)this.getContext();
|
|
229
|
+
// reactContext.getJSModule(RCTEventEmitter.class).receiveEvent(
|
|
230
|
+
// this.getId(),
|
|
231
|
+
// "topChange",
|
|
232
|
+
// event
|
|
233
|
+
// );
|
|
203
234
|
|
|
204
235
|
// process as tap
|
|
205
236
|
return true;
|
|
@@ -219,13 +250,21 @@ public class PdfView extends PDFView implements OnPageChangeListener,OnLoadCompl
|
|
|
219
250
|
|
|
220
251
|
WritableMap event = Arguments.createMap();
|
|
221
252
|
event.putString("message", "scaleChanged|"+(pageWidth/originalWidth));
|
|
253
|
+
ThemedReactContext context = (ThemedReactContext) getContext();
|
|
254
|
+
EventDispatcher dispatcher = UIManagerHelper.getEventDispatcherForReactTag(context, getId());
|
|
255
|
+
int surfaceId = UIManagerHelper.getSurfaceId(this);
|
|
222
256
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
257
|
+
TopChangeEvent tce = new TopChangeEvent(surfaceId, getId(), event);
|
|
258
|
+
|
|
259
|
+
if (dispatcher != null) {
|
|
260
|
+
dispatcher.dispatchEvent(tce);
|
|
261
|
+
}
|
|
262
|
+
// ReactContext reactContext = (ReactContext)this.getContext();
|
|
263
|
+
// reactContext.getJSModule(RCTEventEmitter.class).receiveEvent(
|
|
264
|
+
// this.getId(),
|
|
265
|
+
// "topChange",
|
|
266
|
+
// event
|
|
267
|
+
// );
|
|
229
268
|
}
|
|
230
269
|
|
|
231
270
|
lastPageWidth = pageWidth;
|
|
@@ -281,8 +320,8 @@ public class PdfView extends PDFView implements OnPageChangeListener,OnLoadCompl
|
|
|
281
320
|
.pageSnap(this.pageSnap)
|
|
282
321
|
.autoSpacing(this.autoSpacing)
|
|
283
322
|
.pageFling(this.pageFling)
|
|
284
|
-
.enableSwipe(!this.singlePage)
|
|
285
|
-
.enableDoubletap(!this.singlePage)
|
|
323
|
+
.enableSwipe(!this.singlePage && this.scrollEnabled)
|
|
324
|
+
.enableDoubletap(!this.singlePage && this.enableDoubleTapZoom)
|
|
286
325
|
.enableAnnotationRendering(this.enableAnnotationRendering)
|
|
287
326
|
.linkHandler(this);
|
|
288
327
|
|
|
@@ -297,6 +336,10 @@ public class PdfView extends PDFView implements OnPageChangeListener,OnLoadCompl
|
|
|
297
336
|
}
|
|
298
337
|
}
|
|
299
338
|
|
|
339
|
+
public void setEnableDoubleTapZoom(boolean enableDoubleTapZoom) {
|
|
340
|
+
this.enableDoubleTapZoom = enableDoubleTapZoom;
|
|
341
|
+
}
|
|
342
|
+
|
|
300
343
|
public void setPath(String path) {
|
|
301
344
|
this.path = path;
|
|
302
345
|
}
|
|
@@ -322,6 +365,10 @@ public class PdfView extends PDFView implements OnPageChangeListener,OnLoadCompl
|
|
|
322
365
|
this.horizontal = horizontal;
|
|
323
366
|
}
|
|
324
367
|
|
|
368
|
+
public void setScrollEnabled(boolean scrollEnabled) {
|
|
369
|
+
this.scrollEnabled = scrollEnabled;
|
|
370
|
+
}
|
|
371
|
+
|
|
325
372
|
public void setSpacing(int spacing) {
|
|
326
373
|
this.spacing = spacing;
|
|
327
374
|
}
|
|
@@ -393,12 +440,22 @@ public class PdfView extends PDFView implements OnPageChangeListener,OnLoadCompl
|
|
|
393
440
|
WritableMap event = Arguments.createMap();
|
|
394
441
|
event.putString("message", "linkPressed|"+uri);
|
|
395
442
|
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
443
|
+
ThemedReactContext context = (ThemedReactContext) getContext();
|
|
444
|
+
EventDispatcher dispatcher = UIManagerHelper.getEventDispatcherForReactTag(context, getId());
|
|
445
|
+
int surfaceId = UIManagerHelper.getSurfaceId(this);
|
|
446
|
+
|
|
447
|
+
TopChangeEvent tce = new TopChangeEvent(surfaceId, getId(), event);
|
|
448
|
+
|
|
449
|
+
if (dispatcher != null) {
|
|
450
|
+
dispatcher.dispatchEvent(tce);
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
// ReactContext reactContext = (ReactContext)this.getContext();
|
|
454
|
+
// reactContext.getJSModule(RCTEventEmitter.class).receiveEvent(
|
|
455
|
+
// this.getId(),
|
|
456
|
+
// "topChange",
|
|
457
|
+
// event
|
|
458
|
+
// );
|
|
402
459
|
}
|
|
403
460
|
|
|
404
461
|
/**
|
|
@@ -445,4 +502,4 @@ public class PdfView extends PDFView implements OnPageChangeListener,OnLoadCompl
|
|
|
445
502
|
}
|
|
446
503
|
}
|
|
447
504
|
}
|
|
448
|
-
}
|
|
505
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
package org.wonday.pdf.events;
|
|
2
|
+
|
|
3
|
+
import androidx.annotation.Nullable;
|
|
4
|
+
|
|
5
|
+
import com.facebook.react.bridge.WritableMap;
|
|
6
|
+
import com.facebook.react.uimanager.events.Event;
|
|
7
|
+
|
|
8
|
+
public class TopChangeEvent extends Event<TopChangeEvent> {
|
|
9
|
+
private WritableMap eventData;
|
|
10
|
+
|
|
11
|
+
public TopChangeEvent(int surfaceId, int viewTag, WritableMap data) {
|
|
12
|
+
super(surfaceId, viewTag);
|
|
13
|
+
eventData = data;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
@Override
|
|
17
|
+
public String getEventName() {
|
|
18
|
+
return "topChange";
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
@Nullable
|
|
22
|
+
@Override
|
|
23
|
+
protected WritableMap getEventData() {
|
|
24
|
+
return eventData;
|
|
25
|
+
}
|
|
26
|
+
}
|
package/android/src/paper/java/com/facebook/react/viewmanagers/RNPDFPdfViewManagerDelegate.java
CHANGED
|
@@ -19,7 +19,7 @@ public class RNPDFPdfViewManagerDelegate<T extends View, U extends BaseViewManag
|
|
|
19
19
|
public RNPDFPdfViewManagerDelegate(U viewManager) {
|
|
20
20
|
super(viewManager);
|
|
21
21
|
}
|
|
22
|
-
|
|
22
|
+
|
|
23
23
|
public void setProperty(T view, String propName, @Nullable Object value) {
|
|
24
24
|
switch (propName) {
|
|
25
25
|
case "path":
|
|
@@ -46,6 +46,9 @@ public class RNPDFPdfViewManagerDelegate<T extends View, U extends BaseViewManag
|
|
|
46
46
|
case "showsVerticalScrollIndicator":
|
|
47
47
|
mViewManager.setShowsVerticalScrollIndicator(view, value == null ? false : (boolean) value);
|
|
48
48
|
break;
|
|
49
|
+
case "scrollEnabled":
|
|
50
|
+
mViewManager.setScrollEnabled(view, value == null ? false : (boolean) value);
|
|
51
|
+
break;
|
|
49
52
|
case "enablePaging":
|
|
50
53
|
mViewManager.setEnablePaging(view, value == null ? false : (boolean) value);
|
|
51
54
|
break;
|
|
@@ -55,6 +58,9 @@ public class RNPDFPdfViewManagerDelegate<T extends View, U extends BaseViewManag
|
|
|
55
58
|
case "enableAnnotationRendering":
|
|
56
59
|
mViewManager.setEnableAnnotationRendering(view, value == null ? false : (boolean) value);
|
|
57
60
|
break;
|
|
61
|
+
case "enableDoubleTapZoom":
|
|
62
|
+
mViewManager.setEnableDoubleTapZoom(view, value == null ? false : (boolean) value);
|
|
63
|
+
break;
|
|
58
64
|
case "enableAntialiasing":
|
|
59
65
|
mViewManager.setEnableAntialiasing(view, value == null ? false : (boolean) value);
|
|
60
66
|
break;
|
|
@@ -75,7 +81,6 @@ public class RNPDFPdfViewManagerDelegate<T extends View, U extends BaseViewManag
|
|
|
75
81
|
}
|
|
76
82
|
}
|
|
77
83
|
|
|
78
|
-
@Override
|
|
79
84
|
public void receiveCommand(T view, String commandName, ReadableArray args) {
|
|
80
85
|
switch (commandName) {
|
|
81
86
|
case "setNativePage":
|
package/android/src/paper/java/com/facebook/react/viewmanagers/RNPDFPdfViewManagerInterface.java
CHANGED
|
@@ -21,9 +21,11 @@ public interface RNPDFPdfViewManagerInterface<T extends View> {
|
|
|
21
21
|
void setHorizontal(T view, boolean value);
|
|
22
22
|
void setShowsHorizontalScrollIndicator(T view, boolean value);
|
|
23
23
|
void setShowsVerticalScrollIndicator(T view, boolean value);
|
|
24
|
+
void setScrollEnabled(T view, boolean value);
|
|
24
25
|
void setEnablePaging(T view, boolean value);
|
|
25
26
|
void setEnableRTL(T view, boolean value);
|
|
26
27
|
void setEnableAnnotationRendering(T view, boolean value);
|
|
28
|
+
void setEnableDoubleTapZoom(T view, boolean value);
|
|
27
29
|
void setEnableAntialiasing(T view, boolean value);
|
|
28
30
|
void setFitPolicy(T view, int value);
|
|
29
31
|
void setSpacing(T view, int value);
|
|
@@ -24,7 +24,9 @@
|
|
|
24
24
|
enableAnnotationRendering: ?boolean,
|
|
25
25
|
showsHorizontalScrollIndicator: ?boolean,
|
|
26
26
|
showsVerticalScrollIndicator: ?boolean,
|
|
27
|
+
scrollEnabled: ?boolean,
|
|
27
28
|
enableAntialiasing: ?boolean,
|
|
29
|
+
enableDoubleTapZoom: ?boolean,
|
|
28
30
|
fitPolicy: ?Int32,
|
|
29
31
|
spacing: ?Int32,
|
|
30
32
|
password: ?string,
|
|
@@ -43,4 +45,4 @@ export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
|
|
|
43
45
|
supportedCommands: ['setNativePage'],
|
|
44
46
|
});
|
|
45
47
|
|
|
46
|
-
export default codegenNativeComponent<NativeProps>('RNPDFPdfView');
|
|
48
|
+
export default codegenNativeComponent<NativeProps>('RNPDFPdfView');
|
package/index.d.ts
CHANGED
|
@@ -29,6 +29,7 @@ export type Source = {
|
|
|
29
29
|
|
|
30
30
|
export interface PdfProps {
|
|
31
31
|
style?: ReactNative.StyleProp<ReactNative.ViewStyle>,
|
|
32
|
+
progressContainerStyle?: ReactNative.StyleProp<ReactNative.ViewStyle>,
|
|
32
33
|
source: Source | number,
|
|
33
34
|
page?: number,
|
|
34
35
|
scale?: number,
|
|
@@ -37,6 +38,7 @@ export interface PdfProps {
|
|
|
37
38
|
horizontal?: boolean,
|
|
38
39
|
showsHorizontalScrollIndicator?: boolean,
|
|
39
40
|
showsVerticalScrollIndicator?: boolean,
|
|
41
|
+
scrollEnabled?: boolean,
|
|
40
42
|
spacing?: number,
|
|
41
43
|
password?: string,
|
|
42
44
|
renderActivityIndicator?: (progress: number) => React.ReactElement,
|
|
@@ -44,7 +46,14 @@ export interface PdfProps {
|
|
|
44
46
|
enablePaging?: boolean,
|
|
45
47
|
enableRTL?: boolean,
|
|
46
48
|
enableAnnotationRendering?: boolean,
|
|
47
|
-
|
|
49
|
+
enableDoubleTapZoom?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Fit policy. This will adjust the initial zoom of the PDF based on the initial size of the view and the scale factor.
|
|
52
|
+
* 0 = fit width
|
|
53
|
+
* 1 = fit height
|
|
54
|
+
* 2 = fit both
|
|
55
|
+
*/
|
|
56
|
+
fitPolicy?: 0 | 1 | 2,
|
|
48
57
|
trustAllCerts?: boolean,
|
|
49
58
|
singlePage?: boolean,
|
|
50
59
|
onLoadProgress?: (percent: number,) => void,
|
package/index.js
CHANGED
|
@@ -51,6 +51,7 @@ export default class Pdf extends Component {
|
|
|
51
51
|
enableAnnotationRendering: PropTypes.bool,
|
|
52
52
|
showsHorizontalScrollIndicator: PropTypes.bool,
|
|
53
53
|
showsVerticalScrollIndicator: PropTypes.bool,
|
|
54
|
+
scrollEnabled: PropTypes.bool,
|
|
54
55
|
enablePaging: PropTypes.bool,
|
|
55
56
|
enableRTL: PropTypes.bool,
|
|
56
57
|
fitPolicy: PropTypes.number,
|
|
@@ -86,6 +87,7 @@ export default class Pdf extends Component {
|
|
|
86
87
|
enableAnnotationRendering: true,
|
|
87
88
|
showsHorizontalScrollIndicator: true,
|
|
88
89
|
showsVerticalScrollIndicator: true,
|
|
90
|
+
scrollEnabled: true,
|
|
89
91
|
enablePaging: false,
|
|
90
92
|
enableRTL: false,
|
|
91
93
|
trustAllCerts: true,
|
|
@@ -127,7 +129,7 @@ export default class Pdf extends Component {
|
|
|
127
129
|
|
|
128
130
|
if ((nextSource.uri !== curSource.uri)) {
|
|
129
131
|
// if has download task, then cancel it.
|
|
130
|
-
if (this.lastRNBFTask) {
|
|
132
|
+
if (this.lastRNBFTask && this.lastRNBFTask.cancel) {
|
|
131
133
|
this.lastRNBFTask.cancel(err => {
|
|
132
134
|
this._loadFromSource(this.props.source);
|
|
133
135
|
});
|
|
@@ -146,8 +148,8 @@ export default class Pdf extends Component {
|
|
|
146
148
|
componentWillUnmount() {
|
|
147
149
|
this._mounted = false;
|
|
148
150
|
if (this.lastRNBFTask) {
|
|
149
|
-
this.lastRNBFTask.cancel(err => {
|
|
150
|
-
});
|
|
151
|
+
// this.lastRNBFTask.cancel(err => {
|
|
152
|
+
// });
|
|
151
153
|
this.lastRNBFTask = null;
|
|
152
154
|
}
|
|
153
155
|
|
|
@@ -233,7 +235,7 @@ export default class Pdf extends Component {
|
|
|
233
235
|
} else {
|
|
234
236
|
if (this._mounted) {
|
|
235
237
|
this.setState({
|
|
236
|
-
path:
|
|
238
|
+
path: decodeURIComponent(uri.replace(/file:\/\//i, '')),
|
|
237
239
|
isDownloaded: true,
|
|
238
240
|
});
|
|
239
241
|
}
|
|
@@ -409,7 +411,7 @@ export default class Pdf extends Component {
|
|
|
409
411
|
<View style={[this.props.style,{overflow: 'hidden'}]}>
|
|
410
412
|
{!this.state.isDownloaded?
|
|
411
413
|
(<View
|
|
412
|
-
style={styles.progressContainer}
|
|
414
|
+
style={[styles.progressContainer, this.props.progressContainerStyle]}
|
|
413
415
|
>
|
|
414
416
|
{this.props.renderActivityIndicator
|
|
415
417
|
? this.props.renderActivityIndicator(this.state.progress)
|
package/index.js.flow
CHANGED
|
@@ -41,6 +41,7 @@ export type Props = {
|
|
|
41
41
|
horizontal?: boolean,
|
|
42
42
|
showsHorizontalScrollIndicator?: boolean,
|
|
43
43
|
showsVerticalScrollIndicator?: boolean,
|
|
44
|
+
scrollEnabled?: boolean,
|
|
44
45
|
maxScale?: number,
|
|
45
46
|
minScale?: number,
|
|
46
47
|
singlePage?: boolean,
|
|
@@ -53,6 +54,7 @@ export type Props = {
|
|
|
53
54
|
onPressLink?: (url: string) => void,
|
|
54
55
|
page?: number,
|
|
55
56
|
password?: string,
|
|
57
|
+
progressContainerStyle?: ViewStyleProp,
|
|
56
58
|
scale?: number,
|
|
57
59
|
source: AssetId | Source,
|
|
58
60
|
spacing?: number,
|
|
@@ -40,9 +40,11 @@ UIView
|
|
|
40
40
|
@property(nonatomic) BOOL horizontal;
|
|
41
41
|
@property(nonatomic) BOOL showsVerticalScrollIndicator;
|
|
42
42
|
@property(nonatomic) BOOL showsHorizontalScrollIndicator;
|
|
43
|
+
@property(nonatomic) BOOL scrollEnabled;
|
|
43
44
|
@property(nonatomic) BOOL enablePaging;
|
|
44
45
|
@property(nonatomic) BOOL enableRTL;
|
|
45
46
|
@property(nonatomic) BOOL enableAnnotationRendering;
|
|
47
|
+
@property(nonatomic) BOOL enableDoubleTapZoom;
|
|
46
48
|
@property(nonatomic) int fitPolicy;
|
|
47
49
|
@property(nonatomic) int spacing;
|
|
48
50
|
@property(nonatomic, strong) NSString *password;
|
|
@@ -86,6 +86,12 @@ using namespace facebook::react;
|
|
|
86
86
|
return concreteComponentDescriptorProvider<RNPDFPdfViewComponentDescriptor>();
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
+
// Needed because of this: https://github.com/facebook/react-native/pull/37274
|
|
90
|
+
+ (void)load
|
|
91
|
+
{
|
|
92
|
+
[super load];
|
|
93
|
+
}
|
|
94
|
+
|
|
89
95
|
- (instancetype)initWithFrame:(CGRect)frame
|
|
90
96
|
{
|
|
91
97
|
if (self = [super initWithFrame:frame]) {
|
|
@@ -136,6 +142,10 @@ using namespace facebook::react;
|
|
|
136
142
|
_enableAnnotationRendering = newProps.enableAnnotationRendering;
|
|
137
143
|
[updatedPropNames addObject:@"enableAnnotationRendering"];
|
|
138
144
|
}
|
|
145
|
+
if (_enableDoubleTapZoom != newProps.enableDoubleTapZoom) {
|
|
146
|
+
_enableDoubleTapZoom = newProps.enableDoubleTapZoom;
|
|
147
|
+
[updatedPropNames addObject:@"enableDoubleTapZoom"];
|
|
148
|
+
}
|
|
139
149
|
if (_fitPolicy != newProps.fitPolicy) {
|
|
140
150
|
_fitPolicy = newProps.fitPolicy;
|
|
141
151
|
[updatedPropNames addObject:@"fitPolicy"];
|
|
@@ -161,6 +171,11 @@ using namespace facebook::react;
|
|
|
161
171
|
[updatedPropNames addObject:@"showsVerticalScrollIndicator"];
|
|
162
172
|
}
|
|
163
173
|
|
|
174
|
+
if (_scrollEnabled != newProps.scrollEnabled) {
|
|
175
|
+
_scrollEnabled = newProps.scrollEnabled;
|
|
176
|
+
[updatedPropNames addObject:@"scrollEnabled"];
|
|
177
|
+
}
|
|
178
|
+
|
|
164
179
|
[super updateProps:props oldProps:oldProps];
|
|
165
180
|
[self didSetProps:updatedPropNames];
|
|
166
181
|
}
|
|
@@ -242,11 +257,13 @@ using namespace facebook::react;
|
|
|
242
257
|
_enablePaging = NO;
|
|
243
258
|
_enableRTL = NO;
|
|
244
259
|
_enableAnnotationRendering = YES;
|
|
260
|
+
_enableDoubleTapZoom = YES;
|
|
245
261
|
_fitPolicy = 2;
|
|
246
262
|
_spacing = 10;
|
|
247
263
|
_singlePage = NO;
|
|
248
264
|
_showsHorizontalScrollIndicator = YES;
|
|
249
265
|
_showsVerticalScrollIndicator = YES;
|
|
266
|
+
_scrollEnabled = YES;
|
|
250
267
|
|
|
251
268
|
// init and config PDFView
|
|
252
269
|
_pdfView = [[PDFView alloc] initWithFrame:CGRectMake(0, 0, 500, 500)];
|
|
@@ -272,6 +289,12 @@ using namespace facebook::react;
|
|
|
272
289
|
[[_pdfView document] setDelegate: self];
|
|
273
290
|
[_pdfView setDelegate: self];
|
|
274
291
|
|
|
292
|
+
// Disable built-in double tap, so as not to conflict with custom recognizers.
|
|
293
|
+
for (UIGestureRecognizer *recognizer in _pdfView.gestureRecognizers) {
|
|
294
|
+
if ([recognizer isKindOfClass:[UITapGestureRecognizer class]]) {
|
|
295
|
+
recognizer.enabled = NO;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
275
298
|
|
|
276
299
|
[self bindTap];
|
|
277
300
|
}
|
|
@@ -492,10 +515,37 @@ using namespace facebook::react;
|
|
|
492
515
|
}
|
|
493
516
|
}
|
|
494
517
|
|
|
518
|
+
if (_pdfDocument && ([changedProps containsObject:@"path"] || [changedProps containsObject:@"scrollEnabled"])) {
|
|
519
|
+
if (_scrollEnabled) {
|
|
520
|
+
for (UIView *subview in _pdfView.subviews) {
|
|
521
|
+
if ([subview isKindOfClass:[UIScrollView class]]) {
|
|
522
|
+
UIScrollView *scrollView = (UIScrollView *)subview;
|
|
523
|
+
scrollView.scrollEnabled = YES;
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
} else {
|
|
527
|
+
for (UIView *subview in _pdfView.subviews) {
|
|
528
|
+
if ([subview isKindOfClass:[UIScrollView class]]) {
|
|
529
|
+
UIScrollView *scrollView = (UIScrollView *)subview;
|
|
530
|
+
scrollView.scrollEnabled = NO;
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
|
|
495
536
|
if (_pdfDocument && ([changedProps containsObject:@"path"] || [changedProps containsObject:@"enablePaging"] || [changedProps containsObject:@"horizontal"] || [changedProps containsObject:@"page"])) {
|
|
496
537
|
|
|
497
538
|
PDFPage *pdfPage = [_pdfDocument pageAtIndex:_page-1];
|
|
498
|
-
if (pdfPage) {
|
|
539
|
+
if (pdfPage && _page == 1) {
|
|
540
|
+
// goToDestination() would be better. However, there is an
|
|
541
|
+
// error in the pointLeftTop computation that often results in
|
|
542
|
+
// scrolling to the middle of the page.
|
|
543
|
+
// Special case workaround to make starting at the first page
|
|
544
|
+
// align acceptably.
|
|
545
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
546
|
+
[self->_pdfView goToRect:CGRectMake(0, NSUIntegerMax, 1, 1) onPage:pdfPage];
|
|
547
|
+
});
|
|
548
|
+
} else if (pdfPage) {
|
|
499
549
|
CGRect pdfPageRect = [pdfPage boundsForBox:kPDFDisplayBoxCropBox];
|
|
500
550
|
|
|
501
551
|
// some pdf with rotation, then adjust it
|
|
@@ -705,6 +755,19 @@ using namespace facebook::react;
|
|
|
705
755
|
*/
|
|
706
756
|
- (void)handleDoubleTap:(UITapGestureRecognizer *)recognizer
|
|
707
757
|
{
|
|
758
|
+
|
|
759
|
+
// Prevent double tap from selecting text.
|
|
760
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
761
|
+
[self->_pdfView clearSelection];
|
|
762
|
+
});
|
|
763
|
+
|
|
764
|
+
// Event appears to be consumed; broadcast for JS.
|
|
765
|
+
// _onChange(@{ @"message": @"pageDoubleTap" });
|
|
766
|
+
|
|
767
|
+
if (!_enableDoubleTapZoom) {
|
|
768
|
+
return;
|
|
769
|
+
}
|
|
770
|
+
|
|
708
771
|
// Cycle through min/mid/max scale factors to be consistent with Android
|
|
709
772
|
float min = self->_pdfView.minScaleFactor/self->_fixScaleFactor;
|
|
710
773
|
float max = self->_pdfView.maxScaleFactor/self->_fixScaleFactor;
|
|
@@ -35,9 +35,11 @@ RCT_EXPORT_VIEW_PROPERTY(maxScale, float);
|
|
|
35
35
|
RCT_EXPORT_VIEW_PROPERTY(horizontal, BOOL);
|
|
36
36
|
RCT_EXPORT_VIEW_PROPERTY(showsHorizontalScrollIndicator, BOOL);
|
|
37
37
|
RCT_EXPORT_VIEW_PROPERTY(showsVerticalScrollIndicator, BOOL);
|
|
38
|
+
RCT_EXPORT_VIEW_PROPERTY(scrollEnabled, BOOL);
|
|
38
39
|
RCT_EXPORT_VIEW_PROPERTY(enablePaging, BOOL);
|
|
39
40
|
RCT_EXPORT_VIEW_PROPERTY(enableRTL, BOOL);
|
|
40
41
|
RCT_EXPORT_VIEW_PROPERTY(enableAnnotationRendering, BOOL);
|
|
42
|
+
RCT_EXPORT_VIEW_PROPERTY(enableDoubleTapZoom, BOOL);
|
|
41
43
|
RCT_EXPORT_VIEW_PROPERTY(fitPolicy, int);
|
|
42
44
|
RCT_EXPORT_VIEW_PROPERTY(spacing, int);
|
|
43
45
|
RCT_EXPORT_VIEW_PROPERTY(password, NSString);
|
package/package.json
CHANGED
package/react-native-pdf.podspec
CHANGED
|
@@ -17,24 +17,11 @@ Pod::Spec.new do |s|
|
|
|
17
17
|
s.framework = "PDFKit"
|
|
18
18
|
|
|
19
19
|
if fabric_enabled
|
|
20
|
-
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
|
|
21
|
-
|
|
22
|
-
s.pod_target_xcconfig = {
|
|
23
|
-
'HEADER_SEARCH_PATHS' => '"$(PODS_ROOT)/boost" "$(PODS_ROOT)/boost-for-react-native" "$(PODS_ROOT)/RCT-Folly"',
|
|
24
|
-
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17",
|
|
25
|
-
}
|
|
26
20
|
s.platforms = { ios: '11.0', tvos: '11.0' }
|
|
27
|
-
s.compiler_flags = folly_compiler_flags + ' -DRCT_NEW_ARCH_ENABLED'
|
|
28
21
|
s.source_files = 'ios/**/*.{h,m,mm,cpp}'
|
|
29
22
|
s.requires_arc = true
|
|
23
|
+
install_modules_dependencies(s)
|
|
30
24
|
|
|
31
|
-
s.dependency "React"
|
|
32
|
-
s.dependency "React-RCTFabric"
|
|
33
|
-
s.dependency "React-Codegen"
|
|
34
|
-
s.dependency "RCT-Folly"
|
|
35
|
-
s.dependency "RCTRequired"
|
|
36
|
-
s.dependency "RCTTypeSafety"
|
|
37
|
-
s.dependency "ReactCommon/turbomodule/core"
|
|
38
25
|
else
|
|
39
26
|
s.platform = :ios, '8.0'
|
|
40
27
|
s.source_files = 'ios/**/*.{h,m,mm}'
|