react-native-pdf 6.4.0 → 6.5.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.
package/PdfManager.js CHANGED
@@ -7,25 +7,20 @@
7
7
  */
8
8
 
9
9
  'use strict';
10
- const invariant = require('fbjs/lib/invariant');
11
- const PdfManagerNative = require('react-native').NativeModules.PdfManager;
12
10
 
11
+ const PdfManagerNative = require('react-native').NativeModules.PdfManager;
13
12
 
14
13
  export default class PdfManager {
15
14
 
16
- static loadFile(path: string,
17
- password?: string,): Promise<string> {
18
-
19
- invariant(
20
- typeof path === 'string',
21
- 'path must be a valid string.',
22
- );
15
+ static loadFile(path, password) {
16
+ if (typeof path !== 'string') {
17
+ throw new TypeError('path must be a valid string.');
18
+ }
23
19
 
24
20
  if (password === undefined) {
25
21
  password = "";
26
22
  }
27
23
 
28
24
  return PdfManagerNative.loadFile(path, password);
29
-
30
25
  }
31
- }
26
+ }
package/README.md CHANGED
@@ -23,14 +23,17 @@ So you should install react-native-pdf and react-native-blob-util
23
23
  | react-native-pdf | 4.x.x - 5.0.x | 5.0.9+ | 6.0.0+ | 6.2.0+ | 6.4.0+ |
24
24
  | react-native-blob-util | | | | | 0.13.7+ |
25
25
 
26
+
27
+ > 🚨 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).
28
+
26
29
  ### Installation
27
30
 
28
31
  ```bash
29
32
  # Using npm
30
- npm install react-native-pdf react-native-blob-util fbjs --save
33
+ npm install react-native-pdf react-native-blob-util --save
31
34
 
32
35
  # or using yarn:
33
- yarn add react-native-pdf react-native-blob-util fbjs
36
+ yarn add react-native-pdf react-native-blob-util
34
37
  ```
35
38
 
36
39
  Then follow the instructions for your platform to link react-native-pdf into your project:
@@ -166,6 +169,13 @@ react-native run-ios
166
169
  <details>
167
170
  <summary>ChangeLog details</summary>
168
171
 
172
+ v6.5.0
173
+ 1. Fix: replace mavenCentral with maven
174
+ 2. Breaking Change(Android): replace deprecated repository: jcenter()
175
+ 3. Fix: loading progress
176
+ 4. Add: Typed "source" prop
177
+ 5. Remove: dependency to fbjs
178
+
169
179
  v6.4.0
170
180
  1. Remove sample for reducing NPM package size
171
181
  2. Add support for setting a filename for the cached pdf file
@@ -2,7 +2,7 @@ description = 'react-native-pdf'
2
2
 
3
3
  buildscript {
4
4
  repositories {
5
- jcenter()
5
+ mavenCentral()
6
6
  google()
7
7
  }
8
8
 
@@ -12,11 +12,11 @@ buildscript {
12
12
  }
13
13
 
14
14
  repositories {
15
- jcenter()
15
+ mavenCentral()
16
16
  maven {
17
17
  url 'https://jitpack.io'
18
18
  content {
19
- // Use Jitpack only for AndroidPdfViewer; the rest is hosted at jcenter.
19
+ // Use Jitpack only for AndroidPdfViewer; the rest is hosted at mavenCentral.
20
20
  includeGroup "com.github.TalbotGooday"
21
21
  }
22
22
  }
package/index.d.ts CHANGED
@@ -16,9 +16,20 @@ export type TableContent = {
16
16
  title: string,
17
17
  };
18
18
 
19
+ export type Source = {
20
+ uri?: string;
21
+ headers?: {
22
+ [key: string]: string;
23
+ };
24
+ cache?: boolean;
25
+ cacheFileName?: string;
26
+ expiration?: number;
27
+ method?: string;
28
+ };
29
+
19
30
  interface Props {
20
31
  style?: ReactNative.StyleProp<ReactNative.ViewStyle>,
21
- source: object,
32
+ source: Source | number,
22
33
  page?: number,
23
34
  scale?: number,
24
35
  minScale?: number,
package/index.js CHANGED
@@ -278,7 +278,7 @@ export default class Pdf extends Component {
278
278
  .progress((received, total) => {
279
279
  this.props.onLoadProgress && this.props.onLoadProgress(received / total);
280
280
  if (this._mounted) {
281
- this.setState({progress: Math.floor(received / total)});
281
+ this.setState({progress: received / total});
282
282
  }
283
283
  });
284
284
 
@@ -397,7 +397,7 @@ export default class Pdf extends Component {
397
397
  >
398
398
  {this.props.renderActivityIndicator
399
399
  ? this.props.renderActivityIndicator(this.state.progress)
400
- : <Text>{`${this.state.progress}%`}</Text>}
400
+ : <Text>{`${(this.state.progress * 100).toFixed(2)}%`}</Text>}
401
401
  </View>):(
402
402
  Platform.OS === "android" || Platform.OS === "windows"?(
403
403
  <PdfCustom
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-pdf",
3
- "version": "6.4.0",
3
+ "version": "6.5.0",
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",
@@ -18,7 +18,6 @@
18
18
  UseSystemFocusVisuals="False"
19
19
  PointerWheelChanged="PagesContainer_PointerWheelChanged"
20
20
  Tapped="PagesContainer_Tapped"
21
- DoubleTapped="PagesContainer_DoubleTapped"
22
21
  ViewChanged="PagesContainer_ViewChanged"
23
22
  >
24
23
  <ItemsControl x:Name="Pages" HorizontalAlignment="Center"