react-native-pdf 6.3.0 → 6.6.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 (116) hide show
  1. package/README.md +59 -69
  2. package/android/.gradle/5.6.1/fileChanges/last-build.bin +0 -0
  3. package/android/.gradle/5.6.1/fileHashes/fileHashes.lock +0 -0
  4. package/android/.gradle/5.6.1/gc.properties +0 -0
  5. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  6. package/android/.gradle/buildOutputCleanup/cache.properties +2 -0
  7. package/android/.gradle/vcs-1/gc.properties +0 -0
  8. package/android/build.gradle +3 -3
  9. package/android/src/main/java/org/wonday/pdf/PdfView.java +21 -2
  10. package/ios/RCTPdf/PdfManager.m +11 -1
  11. package/ios/RCTPdf/RCTPdfView.h +2 -0
  12. package/ios/RCTPdf/RCTPdfView.m +21 -5
  13. package/ios/RCTPdf/RCTPdfViewManager.m +1 -1
  14. package/ios/RCTPdf.xcodeproj/xcuserdata/wonday.xcuserdatad/xcschemes/xcschememanagement.plist +14 -0
  15. package/package.json +18 -6
  16. package/windows/RCTPdf/RCTPdfControl.xaml +0 -1
  17. package/windows/README.md +4 -8
  18. package/.babelrc +0 -3
  19. package/.github/workflows/windows-ci.yml +0 -39
  20. package/DoubleTapView.js +0 -126
  21. package/PdfManager.js +0 -31
  22. package/PdfPageView.js +0 -54
  23. package/PdfView.js +0 -416
  24. package/PdfViewFlatList.js +0 -31
  25. package/PinchZoomView.js +0 -126
  26. package/example/.eslintrc.js +0 -4
  27. package/example/PDFExample.js +0 -180
  28. package/example/__windows_tests__/TestPDF.js +0 -43
  29. package/example/android/app/BUCK +0 -55
  30. package/example/android/app/build.gradle +0 -210
  31. package/example/android/app/build_defs.bzl +0 -19
  32. package/example/android/app/proguard-rules.pro +0 -10
  33. package/example/android/app/src/debug/AndroidManifest.xml +0 -8
  34. package/example/android/app/src/main/AndroidManifest.xml +0 -26
  35. package/example/android/app/src/main/assets/test.pdf +0 -0
  36. package/example/android/app/src/main/java/com/pdfexample/MainActivity.java +0 -15
  37. package/example/android/app/src/main/java/com/pdfexample/MainApplication.java +0 -49
  38. package/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
  39. package/example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
  40. package/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
  41. package/example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
  42. package/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
  43. package/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
  44. package/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
  45. package/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
  46. package/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
  47. package/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
  48. package/example/android/app/src/main/res/values/strings.xml +0 -3
  49. package/example/android/app/src/main/res/values/styles.xml +0 -9
  50. package/example/android/build.gradle +0 -38
  51. package/example/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  52. package/example/android/gradle/wrapper/gradle-wrapper.properties +0 -5
  53. package/example/android/gradle.properties +0 -21
  54. package/example/android/gradlew +0 -188
  55. package/example/android/gradlew.bat +0 -100
  56. package/example/android/settings.gradle +0 -3
  57. package/example/app.json +0 -4
  58. package/example/babel.config.js +0 -3
  59. package/example/index.js +0 -9
  60. package/example/ios/PDFExample/AppDelegate.h +0 -15
  61. package/example/ios/PDFExample/AppDelegate.m +0 -42
  62. package/example/ios/PDFExample/Base.lproj/LaunchScreen.xib +0 -42
  63. package/example/ios/PDFExample/Images.xcassets/AppIcon.appiconset/Contents.json +0 -38
  64. package/example/ios/PDFExample/Images.xcassets/Contents.json +0 -6
  65. package/example/ios/PDFExample/Info.plist +0 -57
  66. package/example/ios/PDFExample/main.m +0 -16
  67. package/example/ios/PDFExample-tvOS/Info.plist +0 -53
  68. package/example/ios/PDFExample-tvOSTests/Info.plist +0 -24
  69. package/example/ios/PDFExample.xcodeproj/project.pbxproj +0 -923
  70. package/example/ios/PDFExample.xcodeproj/xcshareddata/xcschemes/PDFExample-tvOS.xcscheme +0 -129
  71. package/example/ios/PDFExample.xcodeproj/xcshareddata/xcschemes/PDFExample.xcscheme +0 -129
  72. package/example/ios/PDFExample.xcworkspace/contents.xcworkspacedata +0 -10
  73. package/example/ios/PDFExampleTests/Info.plist +0 -24
  74. package/example/ios/PDFExampleTests/PDFExampleTests.m +0 -68
  75. package/example/ios/Podfile +0 -47
  76. package/example/ios/Podfile.lock +0 -205
  77. package/example/jest-windows/driver.setup.js +0 -12
  78. package/example/jest-windows/jest.setup.js +0 -1
  79. package/example/jest.windows.config.js +0 -4
  80. package/example/metro.config.js +0 -29
  81. package/example/package.json +0 -48
  82. package/example/test.pdf +0 -0
  83. package/example/windows/PDFExample/App.cpp +0 -80
  84. package/example/windows/PDFExample/App.h +0 -20
  85. package/example/windows/PDFExample/App.idl +0 -3
  86. package/example/windows/PDFExample/App.xaml +0 -10
  87. package/example/windows/PDFExample/Assets/LockScreenLogo.scale-200.png +0 -0
  88. package/example/windows/PDFExample/Assets/SplashScreen.scale-200.png +0 -0
  89. package/example/windows/PDFExample/Assets/Square150x150Logo.scale-200.png +0 -0
  90. package/example/windows/PDFExample/Assets/Square44x44Logo.scale-200.png +0 -0
  91. package/example/windows/PDFExample/Assets/Square44x44Logo.targetsize-24_altform-unplated.png +0 -0
  92. package/example/windows/PDFExample/Assets/StoreLogo.png +0 -0
  93. package/example/windows/PDFExample/Assets/Wide310x150Logo.scale-200.png +0 -0
  94. package/example/windows/PDFExample/AutolinkedNativeModules.g.cpp +0 -18
  95. package/example/windows/PDFExample/AutolinkedNativeModules.g.h +0 -10
  96. package/example/windows/PDFExample/AutolinkedNativeModules.g.props +0 -6
  97. package/example/windows/PDFExample/AutolinkedNativeModules.g.targets +0 -10
  98. package/example/windows/PDFExample/MainPage.cpp +0 -24
  99. package/example/windows/PDFExample/MainPage.h +0 -21
  100. package/example/windows/PDFExample/MainPage.idl +0 -8
  101. package/example/windows/PDFExample/MainPage.xaml +0 -16
  102. package/example/windows/PDFExample/PDFExample.vcxproj +0 -205
  103. package/example/windows/PDFExample/PDFExample.vcxproj.filters +0 -64
  104. package/example/windows/PDFExample/PDFExample_TemporaryKey.pfx +0 -0
  105. package/example/windows/PDFExample/Package.appxmanifest +0 -52
  106. package/example/windows/PDFExample/PropertySheet.props +0 -16
  107. package/example/windows/PDFExample/ReactPackageProvider.cpp +0 -18
  108. package/example/windows/PDFExample/ReactPackageProvider.h +0 -15
  109. package/example/windows/PDFExample/packages.config +0 -5
  110. package/example/windows/PDFExample/pch.cpp +0 -1
  111. package/example/windows/PDFExample/pch.h +0 -29
  112. package/example/windows/PDFExample.sln +0 -264
  113. package/index.d.ts +0 -51
  114. package/index.js +0 -493
  115. package/index.js.flow +0 -63
  116. package/issue_template.md +0 -13
package/index.js DELETED
@@ -1,493 +0,0 @@
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
- requireNativeComponent,
14
- View,
15
- Platform,
16
- ViewPropTypes,
17
- StyleSheet,
18
- Image
19
- } from 'react-native';
20
-
21
- import { ProgressBar } from '@react-native-community/progress-bar-android'
22
- import { ProgressView } from '@react-native-community/progress-view'
23
-
24
- let RNFetchBlob;
25
- try {
26
- RNFetchBlob = require('rn-fetch-blob').default;
27
- } catch(e) {
28
- // For Windows, when not using rn-fetch-blob with Windows support.
29
- RNFetchBlob = {
30
- fs : {
31
- dirs: {
32
- CacheDir: ''
33
- }
34
- }
35
- };
36
- }
37
-
38
- const SHA1 = require('crypto-js/sha1');
39
- import PdfView from './PdfView';
40
-
41
- export default class Pdf extends Component {
42
-
43
- static propTypes = {
44
- ...ViewPropTypes,
45
- source: PropTypes.oneOfType([
46
- PropTypes.shape({
47
- uri: PropTypes.string,
48
- cache: PropTypes.bool,
49
- expiration: PropTypes.number,
50
- }),
51
- // Opaque type returned by require('./test.pdf')
52
- PropTypes.number,
53
- ]).isRequired,
54
- page: PropTypes.number,
55
- scale: PropTypes.number,
56
- minScale: PropTypes.number,
57
- maxScale: PropTypes.number,
58
- horizontal: PropTypes.bool,
59
- spacing: PropTypes.number,
60
- password: PropTypes.string,
61
- progressBarColor: PropTypes.string,
62
- activityIndicator: PropTypes.any,
63
- activityIndicatorProps: PropTypes.any,
64
- enableAntialiasing: PropTypes.bool,
65
- enableAnnotationRendering: PropTypes.bool,
66
- enablePaging: PropTypes.bool,
67
- enableRTL: PropTypes.bool,
68
- fitPolicy: PropTypes.number,
69
- trustAllCerts: PropTypes.bool,
70
- singlePage: PropTypes.bool,
71
- onLoadComplete: PropTypes.func,
72
- onPageChanged: PropTypes.func,
73
- onError: PropTypes.func,
74
- onPageSingleTap: PropTypes.func,
75
- onScaleChanged: PropTypes.func,
76
- onPressLink: PropTypes.func,
77
-
78
- // Props that are not available in the earlier react native version, added to prevent crashed on android
79
- accessibilityLabel: PropTypes.string,
80
- importantForAccessibility: PropTypes.string,
81
- renderToHardwareTextureAndroid: PropTypes.string,
82
- testID: PropTypes.string,
83
- onLayout: PropTypes.bool,
84
- accessibilityLiveRegion: PropTypes.string,
85
- accessibilityComponentType: PropTypes.string,
86
- };
87
-
88
- static defaultProps = {
89
- password: "",
90
- scale: 1,
91
- minScale: 1,
92
- maxScale: 3,
93
- spacing: 10,
94
- fitPolicy: 2, //fit both
95
- horizontal: false,
96
- page: 1,
97
- enableAntialiasing: true,
98
- enableAnnotationRendering: true,
99
- enablePaging: false,
100
- enableRTL: false,
101
- activityIndicatorProps: {color: '#009900', progressTintColor: '#009900'},
102
- trustAllCerts: true,
103
- usePDFKit: true,
104
- singlePage: false,
105
- onLoadProgress: (percent) => {
106
- },
107
- onLoadComplete: (numberOfPages, path) => {
108
- },
109
- onPageChanged: (page, numberOfPages) => {
110
- },
111
- onError: (error) => {
112
- },
113
- onPageSingleTap: (page, x, y) => {
114
- },
115
- onScaleChanged: (scale) => {
116
- },
117
- onPressLink: (url) => {
118
- },
119
- };
120
-
121
- constructor(props) {
122
-
123
- super(props);
124
- this.state = {
125
- path: '',
126
- isDownloaded: false,
127
- progress: 0,
128
- isSupportPDFKit: -1
129
- };
130
-
131
- this.lastRNBFTask = null;
132
-
133
- }
134
-
135
- componentDidUpdate(prevProps) {
136
-
137
- const nextSource = Image.resolveAssetSource(this.props.source);
138
- const curSource = Image.resolveAssetSource(prevProps.source);
139
-
140
- if ((nextSource.uri !== curSource.uri)) {
141
- // if has download task, then cancel it.
142
- if (this.lastRNBFTask) {
143
- this.lastRNBFTask.cancel(err => {
144
- this._loadFromSource(this.props.source);
145
- });
146
- this.lastRNBFTask = null;
147
- } else {
148
- this._loadFromSource(this.props.source);
149
- }
150
- }
151
- }
152
-
153
- componentDidMount() {
154
- this._mounted = true;
155
- if (Platform.OS === "ios") {
156
- const PdfViewManagerNative = require('react-native').NativeModules.PdfViewManager;
157
- PdfViewManagerNative.supportPDFKit((isSupportPDFKit) => {
158
- if (this._mounted) {
159
- this.setState({isSupportPDFKit: isSupportPDFKit ? 1 : 0});
160
- }
161
- });
162
- }
163
- this._loadFromSource(this.props.source);
164
- }
165
-
166
- componentWillUnmount() {
167
- this._mounted = false;
168
- if (this.lastRNBFTask) {
169
- this.lastRNBFTask.cancel(err => {
170
- });
171
- this.lastRNBFTask = null;
172
- }
173
-
174
- }
175
-
176
- _loadFromSource = (newSource) => {
177
-
178
- const source = Image.resolveAssetSource(newSource) || {};
179
-
180
- let uri = source.uri || '';
181
- // first set to initial state
182
- if (this._mounted) {
183
- this.setState({isDownloaded: false, path: '', progress: 0});
184
- }
185
- const cacheFile = RNFetchBlob.fs.dirs.CacheDir + '/' + SHA1(uri) + '.pdf';
186
-
187
- if (source.cache) {
188
- RNFetchBlob.fs
189
- .stat(cacheFile)
190
- .then(stats => {
191
- if (!Boolean(source.expiration) || (source.expiration * 1000 + stats.lastModified) > (new Date().getTime())) {
192
- if (this._mounted) {
193
- this.setState({path: cacheFile, isDownloaded: true});
194
- }
195
- } else {
196
- // cache expirated then reload it
197
- this._prepareFile(source);
198
- }
199
- })
200
- .catch(() => {
201
- this._prepareFile(source);
202
- })
203
-
204
- } else {
205
- this._prepareFile(source);
206
- }
207
- };
208
-
209
- _prepareFile = async (source) => {
210
-
211
- try {
212
- if (source.uri) {
213
- let uri = source.uri || '';
214
-
215
- const isNetwork = !!(uri && uri.match(/^https?:\/\//));
216
- const isAsset = !!(uri && uri.match(/^bundle-assets:\/\//));
217
- const isBase64 = !!(uri && uri.match(/^data:application\/pdf;base64/));
218
-
219
- const cacheFile = RNFetchBlob.fs.dirs.CacheDir + '/' + SHA1(uri) + '.pdf';
220
-
221
- // delete old cache file
222
- this._unlinkFile(cacheFile);
223
-
224
- if (isNetwork) {
225
- this._downloadFile(source, cacheFile);
226
- } else if (isAsset) {
227
- RNFetchBlob.fs
228
- .cp(uri, cacheFile)
229
- .then(() => {
230
- if (this._mounted) {
231
- this.setState({path: cacheFile, isDownloaded: true, progress: 1});
232
- }
233
- })
234
- .catch(async (error) => {
235
- this._unlinkFile(cacheFile);
236
- this._onError(error);
237
- })
238
- } else if (isBase64) {
239
- let data = uri.replace(/data:application\/pdf;base64,/i, '');
240
- RNFetchBlob.fs
241
- .writeFile(cacheFile, data, 'base64')
242
- .then(() => {
243
- if (this._mounted) {
244
- this.setState({path: cacheFile, isDownloaded: true, progress: 1});
245
- }
246
- })
247
- .catch(async (error) => {
248
- this._unlinkFile(cacheFile);
249
- this._onError(error)
250
- });
251
- } else {
252
- if (this._mounted) {
253
- this.setState({
254
- path: uri.replace(/file:\/\//i, ''),
255
- isDownloaded: true,
256
- });
257
- }
258
- }
259
- } else {
260
- this._onError(new Error('no pdf source!'));
261
- }
262
- } catch (e) {
263
- this._onError(e)
264
- }
265
-
266
-
267
- };
268
-
269
- _downloadFile = async (source, cacheFile) => {
270
-
271
- if (this.lastRNBFTask) {
272
- this.lastRNBFTask.cancel(err => {
273
- });
274
- this.lastRNBFTask = null;
275
- }
276
-
277
- const tempCacheFile = cacheFile + '.tmp';
278
- this._unlinkFile(tempCacheFile);
279
-
280
- this.lastRNBFTask = RNFetchBlob.config({
281
- // response data will be saved to this path if it has access right.
282
- path: tempCacheFile,
283
- trusty: this.props.trustAllCerts,
284
- })
285
- .fetch(
286
- source.method ? source.method : 'GET',
287
- source.uri,
288
- source.headers ? source.headers : {},
289
- source.body ? source.body : ""
290
- )
291
- // listen to download progress event
292
- .progress((received, total) => {
293
- this.props.onLoadProgress && this.props.onLoadProgress(received / total);
294
- if (this._mounted) {
295
- this.setState({progress: received / total});
296
- }
297
- });
298
-
299
- this.lastRNBFTask
300
- .then(async (res) => {
301
-
302
- this.lastRNBFTask = null;
303
-
304
- if (res && res.respInfo && res.respInfo.headers && !res.respInfo.headers["Content-Encoding"] && !res.respInfo.headers["Transfer-Encoding"] && res.respInfo.headers["Content-Length"]) {
305
- const expectedContentLength = res.respInfo.headers["Content-Length"];
306
- let actualContentLength;
307
-
308
- try {
309
- const fileStats = await RNFetchBlob.fs.stat(res.path());
310
-
311
- if (!fileStats || !fileStats.size) {
312
- throw new Error("FileNotFound:" + source.uri);
313
- }
314
-
315
- actualContentLength = fileStats.size;
316
- } catch (error) {
317
- throw new Error("DownloadFailed:" + source.uri);
318
- }
319
-
320
- if (expectedContentLength != actualContentLength) {
321
- throw new Error("DownloadFailed:" + source.uri);
322
- }
323
- }
324
-
325
- this._unlinkFile(cacheFile);
326
- RNFetchBlob.fs
327
- .cp(tempCacheFile, cacheFile)
328
- .then(() => {
329
- if (this._mounted) {
330
- this.setState({path: cacheFile, isDownloaded: true, progress: 1});
331
- }
332
- this._unlinkFile(tempCacheFile);
333
- })
334
- .catch(async (error) => {
335
- throw error;
336
- });
337
- })
338
- .catch(async (error) => {
339
- this._unlinkFile(tempCacheFile);
340
- this._unlinkFile(cacheFile);
341
- this._onError(error);
342
- });
343
-
344
- };
345
-
346
- _unlinkFile = async (file) => {
347
- try {
348
- await RNFetchBlob.fs.unlink(file);
349
- } catch (e) {
350
-
351
- }
352
- }
353
-
354
- setNativeProps = nativeProps => {
355
- if (this._root){
356
- this._root.setNativeProps(nativeProps);
357
- }
358
- };
359
-
360
- setPage( pageNumber ) {
361
- if ( (pageNumber === null) || (isNaN(pageNumber)) ) {
362
- throw new Error('Specified pageNumber is not a number');
363
- }
364
- this.setNativeProps({
365
- page: pageNumber
366
- });
367
- }
368
-
369
- _onChange = (event) => {
370
-
371
- let message = event.nativeEvent.message.split('|');
372
- //__DEV__ && console.log("onChange: " + message);
373
- if (message.length > 0) {
374
- if (message.length > 5) {
375
- message[4] = message.splice(4).join('|');
376
- }
377
- if (message[0] === 'loadComplete') {
378
- this.props.onLoadComplete && this.props.onLoadComplete(Number(message[1]), this.state.path, {
379
- width: Number(message[2]),
380
- height: Number(message[3]),
381
- },
382
- message[4]&&JSON.parse(message[4]));
383
- } else if (message[0] === 'pageChanged') {
384
- this.props.onPageChanged && this.props.onPageChanged(Number(message[1]), Number(message[2]));
385
- } else if (message[0] === 'error') {
386
- this._onError(new Error(message[1]));
387
- } else if (message[0] === 'pageSingleTap') {
388
- this.props.onPageSingleTap && this.props.onPageSingleTap(Number(message[1]), Number(message[2]), Number(message[3]));
389
- } else if (message[0] === 'scaleChanged') {
390
- this.props.onScaleChanged && this.props.onScaleChanged(Number(message[1]));
391
- } else if (message[0] === 'linkPressed') {
392
- this.props.onPressLink && this.props.onPressLink(message[1]);
393
- }
394
- }
395
-
396
- };
397
-
398
- _onError = (error) => {
399
-
400
- this.props.onError && this.props.onError(error);
401
-
402
- };
403
-
404
- render() {
405
- if (Platform.OS === "android" || Platform.OS === "ios" || Platform.OS === "windows") {
406
- return (
407
- <View style={[this.props.style,{overflow: 'hidden'}]}>
408
- {!this.state.isDownloaded?
409
- (<View
410
- style={styles.progressContainer}
411
- >
412
- {this.props.activityIndicator
413
- ? this.props.activityIndicator
414
- : Platform.OS === 'android'
415
- ? <ProgressBar
416
- progress={this.state.progress}
417
- indeterminate={false}
418
- styleAttr="Horizontal"
419
- style={styles.progressBar}
420
- {...this.props.activityIndicatorProps}
421
- />
422
- : <ProgressView
423
- progress={this.state.progress}
424
- style={styles.progressBar}
425
- {...this.props.activityIndicatorProps}
426
- />}
427
- </View>):(
428
- Platform.OS === "android" || Platform.OS === "windows"?(
429
- <PdfCustom
430
- ref={component => (this._root = component)}
431
- {...this.props}
432
- style={[{flex:1,backgroundColor: '#EEE'}, this.props.style]}
433
- path={this.state.path}
434
- onChange={this._onChange}
435
- />
436
- ):(
437
- this.props.usePDFKit && this.state.isSupportPDFKit === 1?(
438
- <PdfCustom
439
- ref={component => (this._root = component)}
440
- {...this.props}
441
- style={[{backgroundColor: '#EEE',overflow: 'hidden'}, this.props.style]}
442
- path={this.state.path}
443
- onChange={this._onChange}
444
- />
445
- ):(<PdfView
446
- {...this.props}
447
- style={[{backgroundColor: '#EEE',overflow: 'hidden'}, this.props.style]}
448
- path={this.state.path}
449
- onLoadComplete={this.props.onLoadComplete}
450
- onPageChanged={this.props.onPageChanged}
451
- onError={this._onError}
452
- onPageSingleTap={this.props.onPageSingleTap}
453
- onScaleChanged={this.props.onScaleChanged}
454
- onPressLink={this.props.onPressLink}
455
- />)
456
- )
457
- )}
458
- </View>);
459
- } else {
460
- return (null);
461
- }
462
-
463
-
464
- }
465
- }
466
-
467
-
468
- if (Platform.OS === "android") {
469
- var PdfCustom = requireNativeComponent('RCTPdf', Pdf, {
470
- nativeOnly: {path: true, onChange: true},
471
- })
472
- } else if (Platform.OS === "ios") {
473
- var PdfCustom = requireNativeComponent('RCTPdfView', Pdf, {
474
- nativeOnly: {path: true, onChange: true},
475
- })
476
- } else if (Platform.OS === "windows") {
477
- var PdfCustom = requireNativeComponent('RCTPdf', Pdf, {
478
- nativeOnly: {path: true, onChange: true},
479
- })
480
- }
481
-
482
-
483
- const styles = StyleSheet.create({
484
- progressContainer: {
485
- flex: 1,
486
- justifyContent: 'center',
487
- alignItems: 'center'
488
- },
489
- progressBar: {
490
- width: 200,
491
- height: 2
492
- }
493
- });
package/index.js.flow DELETED
@@ -1,63 +0,0 @@
1
- /**
2
- * @flow strict
3
- */
4
-
5
- import { Component } from 'react';
6
-
7
- import type { Node } from 'react';
8
- import type { FormField, Methods } from 'rn-fetch-blob';
9
- import type { ViewStyleProp } from 'react-native/Libraries/StyleSheet/StyleSheet'
10
-
11
- export type AssetId = number;
12
-
13
- export type FitWidth = 0;
14
- export type FitHeight = 1;
15
- export type FitBoth = 2;
16
-
17
- export type Source = {
18
- body?: string | FormField[],
19
- cache?: boolean,
20
- expiration?: number,
21
- headers?: { [key: string]: string },
22
- method?: Methods,
23
- uri: string
24
- };
25
-
26
- export type TableContent = {
27
- children: TableContent[],
28
- mNativePtr: number,
29
- pageIdx: number,
30
- title: string,
31
- };
32
-
33
- export type Props = {
34
- activityIndicator?: Node,
35
- activityIndicatorProps?: { [prop: string]: mixed },
36
- enableAnnotationRendering?: boolean,
37
- enableAntialiasing?: boolean,
38
- enablePaging?: boolean,
39
- enableRTL?: boolean,
40
- fitPolicy?: FitWidth | FitHeight | FitBoth,
41
- horizontal?: boolean,
42
- maxScale?: number,
43
- minScale?: number,
44
- singlePage?: boolean,
45
- onError?: (error: Error) => void,
46
- onLoadComplete?: (numberOfPages: number, path: string, size: { height: number, width: number }, tableContents: ?TableContent[]) => void,
47
- onLoadProgress?: (percent: number) => void,
48
- onPageChanged?: (page: number, numberOfPages: number) => void,
49
- onPageSingleTap?: (page: number, x: number, y: number) => void,
50
- onScaleChanged?: (scale: number) => void,
51
- onPressLink?: (url: string) => void,
52
- page?: number,
53
- password?: string,
54
- scale?: number,
55
- source: AssetId | Source,
56
- spacing?: number,
57
- style?: ViewStyleProp,
58
- testID?: string
59
- };
60
-
61
- declare export default class Pdf extends Component<Props> {
62
- setPage: (pageNumber: number) => void;
63
- }
package/issue_template.md DELETED
@@ -1,13 +0,0 @@
1
- What `react-native` version are you using?
2
-
3
- What `react-native-pdf` version are you using?
4
-
5
- What platform does your issue occur on? (android/ios/both)
6
-
7
- Describe your issue as precisely as possible :
8
- 1) Steps to reproduce the issue or to explain in which case you get the issue
9
- 2) Interesting `logs`
10
-
11
- Join a screenshot or video of the problem on the simulator or device?
12
-
13
- Show us the code you are using?