react-native-pdf-renderer 1.0.3 → 1.0.4
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/.eslintignore +2 -0
- package/README.md +24 -6
- package/dist/PdfRendererView.js +2 -1
- package/dist/PdfRendererView.js.map +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -0
- package/package.json +2 -4
package/.eslintignore
ADDED
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# React-Native Pdf Renderer
|
|
2
2
|
|
|
3
|
-
[](https://github.com/douglasjunior/react-native-pdf-renderer/blob/master/LICENSE)
|
|
4
4
|
[](https://www.npmjs.com/package/react-native-pdf-renderer?activeTab=versions)
|
|
5
5
|
[](https://www.npmjs.com/package/react-native-pdf-renderer)
|
|
6
6
|
|
|
@@ -35,7 +35,7 @@ Go to the folder **your-project/ios** and run `pod install`, and you're done.
|
|
|
35
35
|
|
|
36
36
|
There is only one component that you need to use to render the PDF file.
|
|
37
37
|
|
|
38
|
-
```
|
|
38
|
+
```jsx
|
|
39
39
|
import PdfRendererView from 'react-native-pdf-renderer';
|
|
40
40
|
|
|
41
41
|
const App = () => {
|
|
@@ -72,14 +72,28 @@ Inherits [View Props](https://reactnative.dev/docs/view#props).
|
|
|
72
72
|
|source|`string`||Path to a file stored on device.|
|
|
73
73
|
|distanceBetweenPages|`number`|`16`|Distance in `DPI` between pages.|
|
|
74
74
|
|maxZoom|`number`|`5`|Max zoom scale.|
|
|
75
|
+
|singlePage|`boolean`|`false`|(Experimental) Renders only the first page without scroll. (useful for display thumbnail)|
|
|
75
76
|
|onPageChange|`(current: number, total: number) => void`||Invoked on pages scroll.|
|
|
76
|
-
|singlePage|`boolean`|`false`|Renders only the first page without scroll. (useful for display thumbnail)|
|
|
77
77
|
|
|
78
78
|
## Limitations
|
|
79
79
|
|
|
80
|
-
|
|
80
|
+
### Size measuring
|
|
81
81
|
|
|
82
|
-
|
|
82
|
+
The `PdfRendererView` is `flex: 1` by default, so you need to make sure that your parents `View` are `flex: 1` or have a fixed `width/height`.
|
|
83
|
+
|
|
84
|
+
### Border radius
|
|
85
|
+
|
|
86
|
+
The `borderRadius` style is ignored by React Native custom view in Android and crash on iOS. (read more #1)
|
|
87
|
+
|
|
88
|
+
If you need `borderRadius`, the best option is to wrap the `PdfRendererView` in another `View`.
|
|
89
|
+
|
|
90
|
+
```jsx
|
|
91
|
+
<View style={{ flex: 1, borderRadius: 24, overflow: 'hidden' }}>
|
|
92
|
+
<PdfRendererView
|
|
93
|
+
// ...
|
|
94
|
+
/>
|
|
95
|
+
</View>
|
|
96
|
+
```
|
|
83
97
|
|
|
84
98
|
## Contribute
|
|
85
99
|
|
|
@@ -97,6 +111,10 @@ This lib is only possible thanks to the community help:
|
|
|
97
111
|
- Using `Matrix` to handle zoom in a View: https://stackoverflow.com/a/55299327/2826279
|
|
98
112
|
- Daniel Felipe Sartório for the help with Android native
|
|
99
113
|
|
|
114
|
+
## Star History
|
|
115
|
+
|
|
116
|
+
[](https://star-history.com/#douglasjunior/react-native-pdf-renderer)
|
|
117
|
+
|
|
100
118
|
## License
|
|
101
119
|
|
|
102
120
|
```
|
|
@@ -105,4 +123,4 @@ The MIT License (MIT)
|
|
|
105
123
|
Copyright (c) 2023 Douglas Nassif Roma Junior
|
|
106
124
|
```
|
|
107
125
|
|
|
108
|
-
See the full [
|
|
126
|
+
See the full [license file](https://github.com/douglasjunior/react-native-pdf-renderer/blob/master/LICENSE).
|
package/dist/PdfRendererView.js
CHANGED
|
@@ -63,7 +63,7 @@ const PdfRendererView = (props) => {
|
|
|
63
63
|
singlePage,
|
|
64
64
|
maxZoom,
|
|
65
65
|
}), [source, singlePage, maxZoom]);
|
|
66
|
-
return (
|
|
66
|
+
return (react_1.default.createElement(PdfRendererNative, { ...others, style: viewStyles, params: params, onPageChange: handlePageChange }));
|
|
67
67
|
};
|
|
68
68
|
PdfRendererView.defaultProps = {
|
|
69
69
|
maxZoom: 5,
|
|
@@ -71,3 +71,4 @@ PdfRendererView.defaultProps = {
|
|
|
71
71
|
singlePage: false,
|
|
72
72
|
};
|
|
73
73
|
exports.default = PdfRendererView;
|
|
74
|
+
//# sourceMappingURL=PdfRendererView.js.map
|
|
@@ -0,0 +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,+CAAkD;AAClD,+CAKsB;AAetB,MAAM,iBAAiB,GAAG,IAAA,qCAAsB,EAAC,mBAAmB,CAAQ,CAAC;AAE7E,MAAM,MAAM,GAAG,yBAAU,CAAC,MAAM,CAAC;IAC/B,OAAO,EAAE;QACP,eAAe,EAAE,MAAM;QACvB,IAAI,EAAE,CAAC;KACR;CACF,CAAC,CAAC;AAEH,MAAM,eAAe,GAAG,CAAC,KAA+B,EAAe,EAAE;IACvE,MAAM,EAAC,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,MAAM,EAAC,GAAG,KAAK,CAAC;IAE5E,MAAM,UAAU,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,EAAE;YACvD,6EAA6E;YAC7E,YAAY,EAAE,IAAI;SACnB,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAEb,MAAM,gBAAgB,GAAG,IAAA,mBAAW,EAClC,CAAC,KAAkD,EAAE,EAAE;QACrD,YAAY,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC,QAAQ,EAAE,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IACtE,CAAC,EACD,CAAC,YAAY,CAAC,CACf,CAAC;IAEF,MAAM,MAAM,GAAG,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/dist/index.js
CHANGED
|
@@ -23,3 +23,4 @@ exports.default = void 0;
|
|
|
23
23
|
// SOFTWARE.
|
|
24
24
|
var PdfRendererView_1 = require("./PdfRendererView");
|
|
25
25
|
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(PdfRendererView_1).default; } });
|
|
26
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"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,qDAA0C;AAAlC,2HAAA,OAAO,OAAA"}
|
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.0.
|
|
4
|
+
"version": "1.0.4",
|
|
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",
|
|
@@ -28,9 +28,8 @@
|
|
|
28
28
|
},
|
|
29
29
|
"homepage": "https://github.com/douglasjunior/react-native-pdf-renderer",
|
|
30
30
|
"scripts": {
|
|
31
|
-
"prepublishOnly": "run-s build pre-publish-script",
|
|
32
31
|
"build": "tsc",
|
|
33
|
-
"
|
|
32
|
+
"publish-script": "node scripts/publish.js"
|
|
34
33
|
},
|
|
35
34
|
"peerDependencies": {
|
|
36
35
|
"react-native": ">=0.60"
|
|
@@ -48,7 +47,6 @@
|
|
|
48
47
|
"eslint": "^8.19.0",
|
|
49
48
|
"jest": "^29.2.1",
|
|
50
49
|
"metro-react-native-babel-preset": "0.73.8",
|
|
51
|
-
"npm-run-all": "^4.1.5",
|
|
52
50
|
"prettier": "^2.4.1",
|
|
53
51
|
"react": "18.2.0",
|
|
54
52
|
"react-native": "0.71.4",
|