react-native-pdf 6.5.0 → 6.6.2

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/DoubleTapView.js CHANGED
@@ -10,11 +10,10 @@
10
10
  import React, {Component} from 'react';
11
11
  import {
12
12
  View,
13
- PanResponder,
14
- ViewPropTypes,
13
+ PanResponder
15
14
  } from 'react-native';
16
15
  import PropTypes from 'prop-types';
17
-
16
+ import {ViewPropTypes} from 'deprecated-react-native-prop-types';
18
17
  export default class DoubleTapView extends Component {
19
18
 
20
19
  static propTypes = {
package/PdfPageView.js CHANGED
@@ -11,10 +11,9 @@
11
11
  import React, {PureComponent} from 'react';
12
12
  import PropTypes from 'prop-types';
13
13
  import {
14
- ViewPropTypes,
15
14
  requireNativeComponent,
16
15
  } from 'react-native';
17
-
16
+ import {ViewPropTypes} from 'deprecated-react-native-prop-types';
18
17
  export default class PdfPageView extends PureComponent {
19
18
  _getStylePropsProps = () => {
20
19
  const {width, height} = this.props;
package/PdfView.js CHANGED
@@ -8,8 +8,8 @@
8
8
 
9
9
  'use strict';
10
10
  import React, {Component} from 'react';
11
- import {ScrollView, FlatList, View, StyleSheet, ViewPropTypes} from 'react-native';
12
-
11
+ import {ScrollView, FlatList, View, StyleSheet} from 'react-native';
12
+ import {ViewPropTypes} from 'deprecated-react-native-prop-types';
13
13
  import PropTypes from 'prop-types';
14
14
 
15
15
  import PdfManager from './PdfManager';
package/PinchZoomView.js CHANGED
@@ -12,10 +12,9 @@ import PropTypes from 'prop-types';
12
12
  import {
13
13
  View,
14
14
  StyleSheet,
15
- PanResponder,
16
- ViewPropTypes,
15
+ PanResponder
17
16
  } from 'react-native';
18
-
17
+ import {ViewPropTypes} from 'deprecated-react-native-prop-types';
19
18
  export default class PinchZoomView extends Component {
20
19
 
21
20
  static propTypes = {
package/README.md CHANGED
@@ -169,6 +169,19 @@ react-native run-ios
169
169
  <details>
170
170
  <summary>ChangeLog details</summary>
171
171
 
172
+ v6.6.2
173
+ 1. Fixed: Migrate to ViewPropTypes exported from 'deprecated-react-native-prop-types'
174
+ 2. Added: Decode File Path for iOS
175
+ 3. Improved: prefer current page for calculating scale factor on fit
176
+
177
+ v6.6.1 depresed
178
+
179
+ v6.6.0 depresed
180
+ 1. Fixed: Migrate to ViewPropTypes exported from 'deprecated-react-native-prop-types'
181
+ 2. Added: Decode File Path for iOS
182
+ 3. Improved: prefer current page for calculating scale factor on fit
183
+ 4. Improved: Typescript version source
184
+
172
185
  v6.5.0
173
186
  1. Fix: replace mavenCentral with maven
174
187
  2. Breaking Change(Android): replace deprecated repository: jcenter()
package/index.js CHANGED
@@ -13,14 +13,13 @@ import {
13
13
  requireNativeComponent,
14
14
  View,
15
15
  Platform,
16
- ViewPropTypes,
17
16
  StyleSheet,
18
17
  Image,
19
18
  Text
20
19
  } from 'react-native';
21
20
 
22
21
  import ReactNativeBlobUtil from 'react-native-blob-util'
23
-
22
+ import {ViewPropTypes} from 'deprecated-react-native-prop-types';
24
23
  const SHA1 = require('crypto-js/sha1');
25
24
  import PdfView from './PdfView';
26
25
 
@@ -50,7 +50,17 @@ RCT_EXPORT_METHOD(loadFile:(NSString *)path
50
50
 
51
51
  if (path != nil && path.length != 0) {
52
52
 
53
- NSURL *pdfURL = [NSURL fileURLWithPath:path];
53
+ NSString *decodedPath = (__bridge_transfer NSString *)CFURLCreateStringByReplacingPercentEscapes(NULL, (CFStringRef)path, CFSTR(""));
54
+
55
+ NSString *finalPath = NULL;
56
+ if (decodedPath == NULL) {
57
+ // use orignal provided path
58
+ finalPath = path;
59
+ } else {
60
+ finalPath = decodedPath;
61
+ }
62
+
63
+ NSURL *pdfURL = [NSURL fileURLWithPath:finalPath];
54
64
  CGPDFDocumentRef pdfRef = CGPDFDocumentCreateWithURL((__bridge CFURLRef) pdfURL);
55
65
 
56
66
  if (pdfRef == NULL) {
@@ -132,6 +132,9 @@ const float MIN_SCALE = 1.0f;
132
132
  _pdfDocument = [[PDFDocument alloc] initWithData:blobData];
133
133
  }
134
134
  } else {
135
+
136
+ // decode file path
137
+ _path = (__bridge_transfer NSString *)CFURLCreateStringByReplacingPercentEscapes(NULL, (CFStringRef)_path, CFSTR(""));
135
138
  NSURL *fileURL = [NSURL fileURLWithPath:_path];
136
139
  _pdfDocument = [[PDFDocument alloc] initWithURL:fileURL];
137
140
  }
@@ -200,7 +203,7 @@ const float MIN_SCALE = 1.0f;
200
203
 
201
204
  if (_pdfDocument && ([changedProps containsObject:@"path"] || [changedProps containsObject:@"fitPolicy"] || [changedProps containsObject:@"minScale"] || [changedProps containsObject:@"maxScale"])) {
202
205
 
203
- PDFPage *pdfPage = [_pdfDocument pageAtIndex:_pdfDocument.pageCount-1];
206
+ PDFPage *pdfPage = _pdfView.currentPage ? _pdfView.currentPage : [_pdfDocument pageAtIndex:_pdfDocument.pageCount-1];
204
207
  CGRect pdfPageRect = [pdfPage boundsForBox:kPDFDisplayBoxCropBox];
205
208
 
206
209
  // some pdf with rotation, then adjust it
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-pdf",
3
- "version": "6.5.0",
3
+ "version": "6.6.2",
4
4
  "summary": "A react native PDF view component",
5
5
  "description": "A react native PDF view component, support ios and android platform",
6
6
  "main": "index.js",
@@ -28,7 +28,8 @@
28
28
  "url": "https://github.com/wonday/react-native-pdf/issues"
29
29
  },
30
30
  "dependencies": {
31
- "crypto-js": "^3.2.0"
31
+ "crypto-js": "^3.2.0",
32
+ "deprecated-react-native-prop-types": "^2.3.0"
32
33
  },
33
34
  "devDependencies": {
34
35
  "prop-types": "^15.7.2"