@kishannareshpal/expo-pdf 0.2.2 → 0.2.3
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/CHANGELOG.md +11 -3
- package/README.md +95 -98
- package/build/pdf-view.d.ts +41 -4
- package/build/pdf-view.d.ts.map +1 -1
- package/build/pdf-view.js.map +1 -1
- package/package.json +1 -1
- package/src/pdf-view.tsx +79 -14
package/CHANGELOG.md
CHANGED
|
@@ -13,18 +13,26 @@
|
|
|
13
13
|
_This version does not introduce any user-facing changes._
|
|
14
14
|
-->
|
|
15
15
|
|
|
16
|
+
## 0.2.3 - 2026-01-11
|
|
17
|
+
|
|
18
|
+
_This version does not introduce any user-facing changes._
|
|
19
|
+
|
|
20
|
+
### 💡 Others
|
|
21
|
+
|
|
22
|
+
- Expose `react-native` `ViewProps` as part of `PdfViewProps`. This change also allows for better compatibility with other libraries such as `uniwind` or `nativewind` that supports `className` ([db7e666](https://github.com/kishannareshpal/expo-pdf/commit/db7e666) by [@kishannareshpal](https://github.com/kishannareshpal))
|
|
23
|
+
- Fix TS docs as well as README prop descriptions ([db7e666](https://github.com/kishannareshpal/expo-pdf/commit/db7e666) by [@kishannareshpal](https://github.com/kishannareshpal))
|
|
24
|
+
|
|
16
25
|
## 0.2.2 - 2026-01-11
|
|
17
26
|
|
|
18
27
|
_This version does not introduce any user-facing changes._
|
|
19
28
|
|
|
20
29
|
### 💡 Others
|
|
21
30
|
|
|
22
|
-
- Export `PdfViewProps`, the props for the main `PdfView` component ([
|
|
31
|
+
- Export `PdfViewProps`, the props for the main `PdfView` component ([8d5c963](https://github.com/kishannareshpal/expo-pdf/commit/8d5c963) by [@kishannareshpal](https://github.com/kishannareshpal))
|
|
23
32
|
|
|
24
33
|
### 🐛 Bug fixes
|
|
25
34
|
|
|
26
|
-
- Fix exported `ErrorCode` literal type to match updated error codes from the native ([
|
|
27
|
-
|
|
35
|
+
- Fix exported `ErrorCode` literal type to match updated error codes from the native ([3a34f39](https://github.com/kishannareshpal/expo-pdf/commit/3a34f39) by [@kishannareshpal](https://github.com/kishannareshpal))
|
|
28
36
|
|
|
29
37
|
## 0.2.1 - 2026-01-09
|
|
30
38
|
|
package/README.md
CHANGED
|
@@ -174,104 +174,101 @@ export const App = () => {
|
|
|
174
174
|
## API
|
|
175
175
|
|
|
176
176
|
<table>
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
</
|
|
253
|
-
<
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
</
|
|
260
|
-
<
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
</
|
|
267
|
-
<
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
<td>-</td>
|
|
273
|
-
</tr>
|
|
274
|
-
</tbody>
|
|
177
|
+
<thead>
|
|
178
|
+
<tr>
|
|
179
|
+
<th>Props</th>
|
|
180
|
+
<th>Required</th>
|
|
181
|
+
<th>Type</th>
|
|
182
|
+
<th>Description</th>
|
|
183
|
+
<th>Default</th>
|
|
184
|
+
</tr>
|
|
185
|
+
</thead>
|
|
186
|
+
<tbody>
|
|
187
|
+
<tr>
|
|
188
|
+
<td><code>uri</code></td>
|
|
189
|
+
<td>Required</td>
|
|
190
|
+
<td><code>string</code></td>
|
|
191
|
+
<td>PDF document URL or local file path.</td>
|
|
192
|
+
<td>-</td>
|
|
193
|
+
</tr>
|
|
194
|
+
<tr>
|
|
195
|
+
<td><code>password</code></td>
|
|
196
|
+
<td>No</td>
|
|
197
|
+
<td><code>string</code></td>
|
|
198
|
+
<td>Password to apply for password-protected PDFs by on load.</td>
|
|
199
|
+
<td><code>undefined</code></td>
|
|
200
|
+
</tr>
|
|
201
|
+
<tr>
|
|
202
|
+
<td><code>pagingEnabled</code></td>
|
|
203
|
+
<td>No</td>
|
|
204
|
+
<td><code>boolean</code></td>
|
|
205
|
+
<td>Enables page-by-page snapping instead of free scrolling.</td>
|
|
206
|
+
<td><code>false</code></td>
|
|
207
|
+
</tr>
|
|
208
|
+
<tr>
|
|
209
|
+
<td><code>doubleTapToZoom</code></td>
|
|
210
|
+
<td>No</td>
|
|
211
|
+
<td><code>boolean</code></td>
|
|
212
|
+
<td>Allows the user to zoom in/out by double-tapping the document.</td>
|
|
213
|
+
<td><code>true</code></td>
|
|
214
|
+
</tr>
|
|
215
|
+
<tr>
|
|
216
|
+
<td><code>horizontal</code></td>
|
|
217
|
+
<td>No</td>
|
|
218
|
+
<td><code>boolean</code></td>
|
|
219
|
+
<td>Renders and scrolls pages horizontally instead of vertically. If paging is enabled, then it changes horizontally.</td>
|
|
220
|
+
<td><code>false</code></td>
|
|
221
|
+
</tr>
|
|
222
|
+
<tr>
|
|
223
|
+
<td><code>pageGap</code></td>
|
|
224
|
+
<td>No</td>
|
|
225
|
+
<td><code>number</code></td>
|
|
226
|
+
<td>Space (in points/pixels) between adjacent pages.</td>
|
|
227
|
+
<td><code>0</code></td>
|
|
228
|
+
</tr>
|
|
229
|
+
<tr>
|
|
230
|
+
<td><code>contentPadding</code></td>
|
|
231
|
+
<td>No</td>
|
|
232
|
+
<td><a href="#contentpadding"><code>ContentPadding</code></a></td>
|
|
233
|
+
<td>Padding applied around the document inside the viewer container.</td>
|
|
234
|
+
<td><code>{ top: 0, left: 0, right: 0, bottom: 0 }</code></td>
|
|
235
|
+
</tr>
|
|
236
|
+
<tr>
|
|
237
|
+
<td><code>fitMode</code></td>
|
|
238
|
+
<td>No</td>
|
|
239
|
+
<td><a href="#fitmode"><code>FitMode</code></a></td>
|
|
240
|
+
<td>How the document is scaled to fit within the viewer (e.g., width or height).</td>
|
|
241
|
+
<td><code>"width"</code></td>
|
|
242
|
+
</tr>
|
|
243
|
+
<tr>
|
|
244
|
+
<td><code>autoScale</code></td>
|
|
245
|
+
<td>No</td>
|
|
246
|
+
<td><code>boolean</code></td>
|
|
247
|
+
<td>Automatically rescales the document when its or its parent’s layout changes after initial render.</td>
|
|
248
|
+
<td><code>true</code></td>
|
|
249
|
+
</tr>
|
|
250
|
+
<tr>
|
|
251
|
+
<td><code>onLoadComplete</code></td>
|
|
252
|
+
<td>No</td>
|
|
253
|
+
<td><a href="#onloadcompleteeventpayload"><code>(OnLoadCompleteEventPayload) => void</code></a></td>
|
|
254
|
+
<td>Triggered once the document and its metadata have finished loading.</td>
|
|
255
|
+
<td>-</td>
|
|
256
|
+
</tr>
|
|
257
|
+
<tr>
|
|
258
|
+
<td><code>onPageChanged</code></td>
|
|
259
|
+
<td>No</td>
|
|
260
|
+
<td><a href="#onpagechangedeventpayload"><code>(OnPageChangedPayload) => void</code></a></td>
|
|
261
|
+
<td>Triggered when the currently visible page index changes.</td>
|
|
262
|
+
<td>-</td>
|
|
263
|
+
</tr>
|
|
264
|
+
<tr>
|
|
265
|
+
<td><code>onError</code></td>
|
|
266
|
+
<td>No</td>
|
|
267
|
+
<td><a href="#onerroreventpayload"><code>(OnErrorPayload) => void</code></a></td>
|
|
268
|
+
<td>Triggered when the PDF fails to load, decrypt, or render.</td>
|
|
269
|
+
<td>-</td>
|
|
270
|
+
</tr>
|
|
271
|
+
</tbody>
|
|
275
272
|
</table>
|
|
276
273
|
|
|
277
274
|
### API Reference
|
package/build/pdf-view.d.ts
CHANGED
|
@@ -1,19 +1,56 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { ContentPadding, FitMode, OnErrorEventPayload, OnLoadCompleteEventPayload, OnPageChangedEventPayload } from './types';
|
|
3
|
-
import {
|
|
4
|
-
type BaseProps = {
|
|
5
|
-
style?: StyleProp<ViewStyle>;
|
|
3
|
+
import { ViewProps } from 'react-native';
|
|
4
|
+
type BaseProps = ViewProps & {
|
|
6
5
|
/**
|
|
7
|
-
* The file URI.
|
|
6
|
+
* The file URI.
|
|
7
|
+
*
|
|
8
|
+
* Accepts either:
|
|
9
|
+
* - a remote resource (e.g., https://…)
|
|
10
|
+
* - a local file path (e.g., file:///…)
|
|
8
11
|
*/
|
|
9
12
|
uri: string;
|
|
13
|
+
/**
|
|
14
|
+
* Password used to open password-protected or encrypted PDFs.
|
|
15
|
+
* If not provided, locked documents will fail to load.
|
|
16
|
+
*/
|
|
10
17
|
password?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Enables page-by-page snapping instead of free scrolling.
|
|
20
|
+
*
|
|
21
|
+
* Defaults to vertical paging. If `horizontal` is true,
|
|
22
|
+
* paging occurs horizontally instead.
|
|
23
|
+
*/
|
|
11
24
|
pagingEnabled?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Enables zoom in/out via double-tap gestures on the document.
|
|
27
|
+
*/
|
|
12
28
|
doubleTapToZoom?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Renders and scrolls pages horizontally instead of vertically.
|
|
31
|
+
*
|
|
32
|
+
* If `pagingEnabled` is true, page snapping will follow the same direction.
|
|
33
|
+
*/
|
|
13
34
|
horizontal?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Space between adjacent pages, expressed in layout units (dp/px depending on platform).
|
|
37
|
+
*/
|
|
14
38
|
pageGap?: number;
|
|
39
|
+
/**
|
|
40
|
+
* Padding applied around the document inside the viewer container.
|
|
41
|
+
*/
|
|
15
42
|
contentPadding?: ContentPadding;
|
|
43
|
+
/**
|
|
44
|
+
* Determines how the document is scaled to fit within the viewer
|
|
45
|
+
* (e.g., fit to width, height, or entire page depending on enum value).
|
|
46
|
+
*/
|
|
16
47
|
fitMode?: FitMode;
|
|
48
|
+
/**
|
|
49
|
+
* Automatically rescales the document when its own layout
|
|
50
|
+
* or its parent view’s layout changes after initial render.
|
|
51
|
+
*
|
|
52
|
+
* Note: initial render always auto-scales according to `fitMode`.
|
|
53
|
+
*/
|
|
17
54
|
autoScale?: boolean;
|
|
18
55
|
};
|
|
19
56
|
export type PdfViewProps = BaseProps & {
|
package/build/pdf-view.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pdf-view.d.ts","sourceRoot":"","sources":["../src/pdf-view.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,mBAAmB,EAAE,0BAA0B,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAC;AAC9H,OAAO,
|
|
1
|
+
{"version":3,"file":"pdf-view.d.ts","sourceRoot":"","sources":["../src/pdf-view.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,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AAE;QACT,eAAe,EAAE,SAAS;KAC3B;CACF,CAAC,CAAA","sourcesContent":["import { requireNativeView } from 'expo';\nimport * as React from 'react';\n\nimport { ContentPadding, FitMode, OnErrorEventPayload, OnLoadCompleteEventPayload, OnPageChangedEventPayload } from './types';\nimport { NativeSyntheticEvent, StyleSheet, ViewProps } from 'react-native';\nimport { forwardNativeEventTo } from './utils';\n\ntype BaseProps = ViewProps & {\n /**\n * The file URI.\n *\n * Accepts either:\n * - a remote resource (e.g., https://…)\n * - a local file path (e.g., file:///…)\n */\n uri: string;\n\n /**\n * Password used to open password-protected or encrypted PDFs.\n * If not provided, locked documents will fail to load.\n */\n password?: string;\n\n /**\n * Enables page-by-page snapping instead of free scrolling.\n *\n * Defaults to vertical paging. If `horizontal` is true,\n * paging occurs horizontally instead.\n */\n pagingEnabled?: boolean;\n\n /**\n * Enables zoom in/out via double-tap gestures on the document.\n */\n doubleTapToZoom?: boolean;\n\n /**\n * Renders and scrolls pages horizontally instead of vertically.\n *\n * If `pagingEnabled` is true, page snapping will follow the same direction.\n */\n horizontal?: boolean;\n\n /**\n * Space between adjacent pages, expressed in layout units (dp/px depending on platform).\n */\n pageGap?: number;\n\n /**\n * Padding applied around the document inside the viewer container.\n */\n contentPadding?: ContentPadding;\n\n /**\n * Determines how the document is scaled to fit within the viewer\n * (e.g., fit to width, height, or entire page depending on enum value).\n */\n fitMode?: FitMode;\n\n /**\n * Automatically rescales the document when its own layout\n * or its parent view’s layout changes after initial render.\n *\n * Note: initial render always auto-scales according to `fitMode`.\n */\n autoScale?: boolean;\n}\n\ntype NativePdfViewProps = BaseProps & {\n /**\n * Fired after the PDF document has been fully loaded\n * and its metadata (such as page count) is available.\n */\n onLoadComplete?: (\n event: NativeSyntheticEvent<OnLoadCompleteEventPayload>\n ) => void;\n\n /**\n * Fired when the currently visible page changes due to user interaction\n * or programmatic scroll/paging.\n */\n onPageChanged?: (\n event: NativeSyntheticEvent<OnPageChangedEventPayload>\n ) => void;\n\n /**\n * Fired when the PDF fails to load, decrypt, or render.\n * The payload contains error information.\n */\n onError?: (\n event: NativeSyntheticEvent<OnErrorEventPayload>\n ) => void;\n};\n\nconst NativePdfView: React.ComponentType<NativePdfViewProps> = requireNativeView('KJExpoPdf');\n\n// -----------\n\nexport type PdfViewProps = BaseProps & {\n onLoadComplete?: (params: OnLoadCompleteEventPayload) => void,\n onPageChanged?: (params: OnPageChangedEventPayload) => void,\n onError?: (params: OnErrorEventPayload) => void\n};\n\nexport const PdfView = ({\n style,\n onLoadComplete,\n onError,\n onPageChanged,\n ...props\n}: PdfViewProps) => {\n return (\n <NativePdfView\n style={[styles.container, style]}\n uri={props.uri}\n doubleTapToZoom={props.doubleTapToZoom}\n horizontal={props.horizontal}\n pageGap={props.pageGap}\n pagingEnabled={props.pagingEnabled}\n password={props.password}\n contentPadding={props.contentPadding}\n fitMode={props.fitMode}\n autoScale={props.autoScale}\n onLoadComplete={forwardNativeEventTo(onLoadComplete)}\n onPageChanged={forwardNativeEventTo(onPageChanged)}\n onError={forwardNativeEventTo(onError)}\n />\n )\n}\n\nconst styles = StyleSheet.create({\n container: {\n backgroundColor: '#eeeeee'\n }\n})\n"]}
|
package/package.json
CHANGED
package/src/pdf-view.tsx
CHANGED
|
@@ -2,29 +2,94 @@ import { requireNativeView } from 'expo';
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
|
|
4
4
|
import { ContentPadding, FitMode, OnErrorEventPayload, OnLoadCompleteEventPayload, OnPageChangedEventPayload } from './types';
|
|
5
|
-
import { NativeSyntheticEvent,
|
|
5
|
+
import { NativeSyntheticEvent, StyleSheet, ViewProps } from 'react-native';
|
|
6
6
|
import { forwardNativeEventTo } from './utils';
|
|
7
7
|
|
|
8
|
-
type BaseProps = {
|
|
9
|
-
style?: StyleProp<ViewStyle>;
|
|
8
|
+
type BaseProps = ViewProps & {
|
|
10
9
|
/**
|
|
11
|
-
* The file URI.
|
|
10
|
+
* The file URI.
|
|
11
|
+
*
|
|
12
|
+
* Accepts either:
|
|
13
|
+
* - a remote resource (e.g., https://…)
|
|
14
|
+
* - a local file path (e.g., file:///…)
|
|
12
15
|
*/
|
|
13
16
|
uri: string;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Password used to open password-protected or encrypted PDFs.
|
|
20
|
+
* If not provided, locked documents will fail to load.
|
|
21
|
+
*/
|
|
14
22
|
password?: string;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Enables page-by-page snapping instead of free scrolling.
|
|
26
|
+
*
|
|
27
|
+
* Defaults to vertical paging. If `horizontal` is true,
|
|
28
|
+
* paging occurs horizontally instead.
|
|
29
|
+
*/
|
|
30
|
+
pagingEnabled?: boolean;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Enables zoom in/out via double-tap gestures on the document.
|
|
34
|
+
*/
|
|
35
|
+
doubleTapToZoom?: boolean;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Renders and scrolls pages horizontally instead of vertically.
|
|
39
|
+
*
|
|
40
|
+
* If `pagingEnabled` is true, page snapping will follow the same direction.
|
|
41
|
+
*/
|
|
42
|
+
horizontal?: boolean;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Space between adjacent pages, expressed in layout units (dp/px depending on platform).
|
|
46
|
+
*/
|
|
47
|
+
pageGap?: number;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Padding applied around the document inside the viewer container.
|
|
51
|
+
*/
|
|
52
|
+
contentPadding?: ContentPadding;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Determines how the document is scaled to fit within the viewer
|
|
56
|
+
* (e.g., fit to width, height, or entire page depending on enum value).
|
|
57
|
+
*/
|
|
58
|
+
fitMode?: FitMode;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Automatically rescales the document when its own layout
|
|
62
|
+
* or its parent view’s layout changes after initial render.
|
|
63
|
+
*
|
|
64
|
+
* Note: initial render always auto-scales according to `fitMode`.
|
|
65
|
+
*/
|
|
66
|
+
autoScale?: boolean;
|
|
22
67
|
}
|
|
23
68
|
|
|
24
69
|
type NativePdfViewProps = BaseProps & {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
70
|
+
/**
|
|
71
|
+
* Fired after the PDF document has been fully loaded
|
|
72
|
+
* and its metadata (such as page count) is available.
|
|
73
|
+
*/
|
|
74
|
+
onLoadComplete?: (
|
|
75
|
+
event: NativeSyntheticEvent<OnLoadCompleteEventPayload>
|
|
76
|
+
) => void;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Fired when the currently visible page changes due to user interaction
|
|
80
|
+
* or programmatic scroll/paging.
|
|
81
|
+
*/
|
|
82
|
+
onPageChanged?: (
|
|
83
|
+
event: NativeSyntheticEvent<OnPageChangedEventPayload>
|
|
84
|
+
) => void;
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Fired when the PDF fails to load, decrypt, or render.
|
|
88
|
+
* The payload contains error information.
|
|
89
|
+
*/
|
|
90
|
+
onError?: (
|
|
91
|
+
event: NativeSyntheticEvent<OnErrorEventPayload>
|
|
92
|
+
) => void;
|
|
28
93
|
};
|
|
29
94
|
|
|
30
95
|
const NativePdfView: React.ComponentType<NativePdfViewProps> = requireNativeView('KJExpoPdf');
|