-
Notifications
You must be signed in to change notification settings - Fork 649
Expand file tree
/
Copy pathindex.d.ts
More file actions
90 lines (82 loc) · 2.53 KB
/
index.d.ts
File metadata and controls
90 lines (82 loc) · 2.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/**
* Copyright (c) 2017-present, Wonday (@wonday.org)
* All rights reserved.
*
* This source code is licensed under the MIT-style license found in the
* LICENSE file in the root directory of this source tree.
*/
import * as React from 'react';
import * as ReactNative from 'react-native';
export type TableContent = {
children: TableContent[],
mNativePtr: number,
pageIdx: number,
title: string,
};
export type Source = {
uri?: string;
headers?: {
[key: string]: string;
};
cache?: boolean;
cacheFileName?: string;
expiration?: number;
method?: string;
};
export type TextSelectionChangeEvent = {
nativeEvent:
| {
type: 'selectionCleared';
}
| {
type: 'selectionChanged';
text: string;
};
};
export interface PdfProps {
style?: ReactNative.StyleProp<ReactNative.ViewStyle>,
progressContainerStyle?: ReactNative.StyleProp<ReactNative.ViewStyle>,
source: Source | number,
page?: number,
scale?: number,
minScale?: number,
maxScale?: number,
horizontal?: boolean,
showsHorizontalScrollIndicator?: boolean,
showsVerticalScrollIndicator?: boolean,
scrollEnabled?: boolean,
spacing?: number,
password?: string,
renderActivityIndicator?: (progress: number) => React.ReactElement,
enableAntialiasing?: boolean,
enablePaging?: boolean,
enableRTL?: boolean,
enableAnnotationRendering?: boolean,
enableDoubleTapZoom?: boolean;
/**
* Only works on iOS. Defaults to `true`.
*/
enableTextSelection?: boolean;
/**
* Fit policy. This will adjust the initial zoom of the PDF based on the initial size of the view and the scale factor.
* 0 = fit width
* 1 = fit height
* 2 = fit both
*/
fitPolicy?: 0 | 1 | 2,
trustAllCerts?: boolean,
singlePage?: boolean,
onLoadProgress?: (percent: number,) => void,
onLoadComplete?: (numberOfPages: number, path: string, size: {height: number, width: number}, tableContents?: TableContent[]) => void,
onPageChanged?: (page: number, numberOfPages: number) => void,
onError?: (error: object) => void,
onPageSingleTap?: (page: number, x: number, y: number) => void,
onScaleChanged?: (scale: number) => void,
onPressLink?: (url: string) => void,
onTextSelectionChange?: (event: TextSelectionChangeEvent) => void,
}
export interface PdfRef {
setPage(pageNumber: number): void
}
declare const Pdf: React.ForwardRefExoticComponent<PdfProps & React.RefAttributes<PdfRef>>
export default Pdf;