react-native-pdf-renderer 1.1.0 → 1.2.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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # React-Native Pdf Renderer
2
2
 
3
- [![License MIT](https://img.shields.io/badge/licence-MIT-blue.svg)](https://github.com/douglasjunior/react-native-pdf-renderer/blob/master/LICENSE)
3
+ [![License MIT](https://img.shields.io/badge/licence-MIT-blue.svg)](https://github.com/douglasjunior/react-native-pdf-renderer/blob/main/LICENSE)
4
4
  [![npm version](https://img.shields.io/npm/v/react-native-pdf-renderer.svg)](https://www.npmjs.com/package/react-native-pdf-renderer?activeTab=versions)
5
5
  [![npm downloads](https://img.shields.io/npm/dt/react-native-pdf-renderer.svg)](https://www.npmjs.com/package/react-native-pdf-renderer)
6
6
 
@@ -61,12 +61,10 @@ The `source` prop must point to a file stored inside device memory.
61
61
 
62
62
  If the file is online, you can use some third part library like `expo-file-system`, `rn-fetch-blob` or `react-native-blob-util` to download and save locally.
63
63
 
64
- For more details, see the [Sample Project](https://github.com/douglasjunior/react-native-pdf-renderer/blob/master/Sample/App.tsx).
64
+ For more details, see the [Sample Project](https://github.com/douglasjunior/react-native-pdf-renderer/blob/main/Sample/App.tsx).
65
65
 
66
66
  ## PdfRendererView props
67
67
 
68
- Inherits [View Props](https://reactnative.dev/docs/view#props).
69
-
70
68
  |Name|Value|Default|Description|
71
69
  |-|-|-|-|
72
70
  |source|`string`||Path to a file stored on device.|
@@ -74,6 +72,7 @@ Inherits [View Props](https://reactnative.dev/docs/view#props).
74
72
  |maxZoom|`number`|`5`|Max zoom scale.|
75
73
  |singlePage|`boolean`|`false`|(Experimental) Renders only the first page without scroll. (useful for display thumbnail)|
76
74
  |onPageChange|`(current: number, total: number) => void`||Invoked on pages scroll.|
75
+ |style|`StyleProp<ViewStyle>`||Styles to be applied to the View |
77
76
 
78
77
  ## Limitations
79
78
 
@@ -123,4 +122,4 @@ The MIT License (MIT)
123
122
  Copyright (c) 2023 Douglas Nassif Roma Junior
124
123
  ```
125
124
 
126
- See the full [license file](https://github.com/douglasjunior/react-native-pdf-renderer/blob/master/LICENSE).
125
+ See the full [license file](https://github.com/douglasjunior/react-native-pdf-renderer/blob/main/LICENSE).
@@ -1,5 +1,4 @@
1
1
  <manifest xmlns:android="http://schemas.android.com/apk/res/android"
2
2
  package="com.github.douglasjunior.reactNativePdfRenderer" >
3
3
 
4
- <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
5
4
  </manifest>
@@ -156,7 +156,9 @@ public class PdfRendererRecyclerView extends RecyclerView {
156
156
  @Override
157
157
  protected void onSizeChanged(int w, int h, int oldw, int oldh) {
158
158
  super.onSizeChanged(w, h, oldw, oldh);
159
- float scale = Math.max(w / mWidth, h / mHeight);
159
+ float scale = mWidth > 0 && mHeight > 0
160
+ ? Math.max(w / mWidth, h / mHeight)
161
+ : 1;
160
162
  mMatrix.setScale(scale, scale);
161
163
  mMatrix.postTranslate((w - scale * mWidth) / 2f, (h - scale * mHeight) / 2f);
162
164
  }
@@ -1,5 +1,6 @@
1
1
  import { ViewProps } from 'react-native';
2
- export declare type PdfRendererViewPropsType = ViewProps & {
2
+ export declare type PdfRendererViewPropsType = {
3
+ style?: ViewProps['style'];
3
4
  source?: string;
4
5
  distanceBetweenPages: number;
5
6
  maxZoom: number;
@@ -1 +1 @@
1
- {"version":3,"file":"PdfRendererView.js","sourceRoot":"","sources":["../src/PdfRendererView.tsx"],"names":[],"mappings":";AAAA,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;AAEd,gDAAgD;AAEhD,+EAA+E;AAC/E,gFAAgF;AAChF,+EAA+E;AAC/E,4EAA4E;AAC5E,wEAAwE;AACxE,2DAA2D;AAE3D,iFAAiF;AACjF,kDAAkD;AAElD,6EAA6E;AAC7E,2EAA2E;AAC3E,8EAA8E;AAC9E,yEAAyE;AACzE,gFAAgF;AAChF,gFAAgF;AAChF,YAAY;AAEZ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AG,IAAA,eAAO,EACpB,GAAG,EAAE,CAAC,CAAC;QACL,MAAM;QACN,UAAU;QACV,OAAO;KACR,CAAC,EACF,CAAC,MAAM,EAAE,UAAU,EAAE,OAAO,CAAC,CAC9B,CAAC;IAEF,OAAO,CACL,8BAAC,iBAAiB,OACZ,MAAM,EACV,KAAK,EAAE,UAAU,EACjB,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,gBAAgB,GAC9B,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,CAAC,YAAY,GAAG;IAC7B,OAAO,EAAE,CAAC;IACV,oBAAoB,EAAE,EAAE;IACxB,UAAU,EAAE,KAAK;CAClB,CAAC;AAEF,kBAAe,eAAe,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "react-native-pdf-renderer",
3
3
  "displayName": "React-Native Pdf Renderer",
4
- "version": "1.1.0",
4
+ "version": "1.2.0",
5
5
  "description": "⚛ A zoomable, blazing fast, zero dependencies, pure native, typed PDF Renderer for Android and iOS.",
6
6
  "main": "dist",
7
7
  "license": "MIT",