react-native-pdf-renderer 1.0.2 → 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/.gitattributes +1 -1
- package/README.md +31 -7
- package/dist/PdfRendererView.js +6 -2
- package/dist/PdfRendererView.js.map +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -0
- package/ios/{ReactNativePdfRenderer.xcodeproj → RNPdfRendererView.xcodeproj}/xcuserdata/douglas.junior.xcuserdatad/xcschemes/xcschememanagement.plist +1 -1
- package/package.json +2 -4
- package/android/local.properties +0 -8
- /package/ios/{ReactNativePdfRenderer.xcodeproj → RNPdfRendererView.xcodeproj}/project.xcworkspace/xcuserdata/douglas.junior.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
package/.eslintignore
ADDED
package/.gitattributes
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
*.pbxproj -text
|
|
2
|
-
Sample
|
|
2
|
+
Sample/** linguist-documentation
|
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# React-Native Pdf Renderer
|
|
2
2
|
|
|
3
|
-
[](https://www.npmjs.com/package/react-native-pdf-renderer)
|
|
5
|
-
[](
|
|
3
|
+
[](https://github.com/douglasjunior/react-native-pdf-renderer/blob/master/LICENSE)
|
|
4
|
+
[](https://www.npmjs.com/package/react-native-pdf-renderer?activeTab=versions)
|
|
5
|
+
[](https://www.npmjs.com/package/react-native-pdf-renderer)
|
|
6
6
|
|
|
7
7
|
⚛ A zoomable, blazing fast, zero dependencies, pure native, typed PDF Renderer for Android and iOS.
|
|
8
8
|
|
|
@@ -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 = () => {
|
|
@@ -63,7 +63,7 @@ If the file is online, you can use some third part library like `expo-file-syste
|
|
|
63
63
|
|
|
64
64
|
For more details, see the [Sample Project](https://github.com/douglasjunior/react-native-pdf-renderer/blob/master/Sample/App.tsx).
|
|
65
65
|
|
|
66
|
-
##
|
|
66
|
+
## PdfRendererView props
|
|
67
67
|
|
|
68
68
|
Inherits [View Props](https://reactnative.dev/docs/view#props).
|
|
69
69
|
|
|
@@ -72,8 +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
|
-
|
|
77
|
+
|
|
78
|
+
## Limitations
|
|
79
|
+
|
|
80
|
+
### Size measuring
|
|
81
|
+
|
|
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
|
+
```
|
|
77
97
|
|
|
78
98
|
## Contribute
|
|
79
99
|
|
|
@@ -91,6 +111,10 @@ This lib is only possible thanks to the community help:
|
|
|
91
111
|
- Using `Matrix` to handle zoom in a View: https://stackoverflow.com/a/55299327/2826279
|
|
92
112
|
- Daniel Felipe Sartório for the help with Android native
|
|
93
113
|
|
|
114
|
+
## Star History
|
|
115
|
+
|
|
116
|
+
[](https://star-history.com/#douglasjunior/react-native-pdf-renderer)
|
|
117
|
+
|
|
94
118
|
## License
|
|
95
119
|
|
|
96
120
|
```
|
|
@@ -99,4 +123,4 @@ The MIT License (MIT)
|
|
|
99
123
|
Copyright (c) 2023 Douglas Nassif Roma Junior
|
|
100
124
|
```
|
|
101
125
|
|
|
102
|
-
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
|
@@ -51,7 +51,10 @@ const styles = react_native_1.StyleSheet.create({
|
|
|
51
51
|
});
|
|
52
52
|
const PdfRendererView = (props) => {
|
|
53
53
|
const { onPageChange, style, source, singlePage, maxZoom, ...others } = props;
|
|
54
|
-
const viewStyles = (0, react_1.useMemo)(() => [styles.default, style
|
|
54
|
+
const viewStyles = (0, react_1.useMemo)(() => [styles.default, style, {
|
|
55
|
+
// See https://github.com/douglasjunior/react-native-pdf-renderer#limitations
|
|
56
|
+
borderRadius: null,
|
|
57
|
+
}], [style]);
|
|
55
58
|
const handlePageChange = (0, react_1.useCallback)((event) => {
|
|
56
59
|
onPageChange?.(event.nativeEvent.position, event.nativeEvent.total);
|
|
57
60
|
}, [onPageChange]);
|
|
@@ -60,7 +63,7 @@ const PdfRendererView = (props) => {
|
|
|
60
63
|
singlePage,
|
|
61
64
|
maxZoom,
|
|
62
65
|
}), [source, singlePage, maxZoom]);
|
|
63
|
-
return (
|
|
66
|
+
return (react_1.default.createElement(PdfRendererNative, { ...others, style: viewStyles, params: params, onPageChange: handlePageChange }));
|
|
64
67
|
};
|
|
65
68
|
PdfRendererView.defaultProps = {
|
|
66
69
|
maxZoom: 5,
|
|
@@ -68,3 +71,4 @@ PdfRendererView.defaultProps = {
|
|
|
68
71
|
singlePage: false,
|
|
69
72
|
};
|
|
70
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",
|
package/android/local.properties
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
## This file must *NOT* be checked into Version Control Systems,
|
|
2
|
-
# as it contains information specific to your local configuration.
|
|
3
|
-
#
|
|
4
|
-
# Location of the SDK. This is only used by Gradle.
|
|
5
|
-
# For customization when using a Version Control System, please read the
|
|
6
|
-
# header note.
|
|
7
|
-
#Thu Mar 09 08:57:39 BRT 2023
|
|
8
|
-
sdk.dir=/Users/douglas.junior/Library/Android/sdk
|