forked from rumax/react-native-PDFView
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
103 lines (87 loc) · 2.82 KB
/
index.d.ts
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
91
92
93
94
95
96
97
98
99
100
101
102
103
// Type definitions for react-native-view-pdf 0.8.1
// Project: https://github.com/rumax/react-native-PDFView
// Definitions by: Uilque Messias <https://github.com/uqmessias>
// TypeScript Version: 3.2.1
import * as React from "react";
import { StyleProp, ViewStyle } from "react-native";
export interface PDFViewUrlProps {
/**
* `method` is the HTTP Method to use. Defaults to GET if not specified.
*/
method?: string;
/**
* `headers` is an object representing the HTTP headers to send along with the
* request for a remote image.
*/
headers?: { [key: string]: string };
/**
* `body` is the HTTP body to send with the request. This must be a valid
* UTF-8 string, and will be sent exactly as specified, with no
* additional encoding (e.g. URL-escaping or base64) applied.
*/
body?: string;
}
interface PDFViewProps {
/**
* A Function. Invoked on load error with {nativeEvent: {error}}.
*/
onError?: (error: { message: string }) => void;
/**
* A Function. Invoked when load completes successfully.
*/
onLoad?: () => void;
/**
* A Function. Invoked when page is changed.
* @param {Number} page - The active page.
* @param {Number} pageCount - Total pages.
*/
onPageChanged?: (page: number, pageCount: number) => void;
/**
* A Function. Invoked when page is sscrolled.
* @param {Number} offset - Offet. Currrently only 1 and 0 are supported.
* where:
* 0 - begining of the document
* 1 - end of the document
*/
onScrolled?: (offset: number) => void;
/**
* A String value. Defines the resource to render. Can be one of:
* - url. Example: http://www.pdf995.com/samples/pdf.pdf
* - base64. Example: 'JVBERi0xLjcKCjEgMCBvYmogICUgZW50...'
* - fileName - Example: Platform.OS === 'ios' ?
* 'test-pdf.pdf' : '/sdcard/Download/test-pdf.pdf'
*/
resource: string;
/**
* A String value. Defines the resource type. Can be one of:
* - "url", for url
* - "base64", for base64 data
* - "file", for local files
*/
resourceType?: "url" | "base64" | "file";
/**
* iOS file location. Can be one of:
* - "bundle"
* - "documentsDirectory"
* - "libraryDirectory"
* - "tempDirectory"
*/
fileFrom?: "bundle" | "documentsDirectory" | "libraryDirectory" | "tempDirectory";
urlProps?: PDFViewUrlProps;
/**
* A String value. Defines encoding type. Can be one of:
* - "utf-8", default
* - "utf-16"
*/
textEncoding?: "utf-8" | "utf-16";
/**
* A Number value. Fades in effect (in ms) on load successfully:
* - 0.0, default
*/
fadeInDuration?: number;
/**
* A style for the PDFView
*/
style?: StyleProp<ViewStyle>;
}
export default class PDFView extends React.Component<PDFViewProps, {}> {}