forked from RepairShopr/react-native-signature-capture
-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.d.ts
116 lines (99 loc) · 2.95 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
104
105
106
107
108
109
110
111
112
113
114
115
116
// Type definitions for react-native-signature-capture 0.4
// Project: https://github.com/RepairShopr/react-native-signature-capture#readme
// Definitions by: Ifiok Jr. <https://github.com/ifiokjr>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
/*~ If this module is a UMD module that exposes a global variable 'myLib' when
*~ loaded outside a module loader environment, declare that global here.
*~ Otherwise, delete this declaration.
*/
import { Component } from "react";
import { ViewProps } from "react-native";
export interface SignatureCaptureProps extends ViewProps {
/**
* Make this props true, if you want to save the image file in external storage.
* Warning: Image file will be visible in gallery or any other image browsing app
*
* @default false
*/
saveImageFileInExtStorage?: boolean | undefined;
/**
* If this props is made to false, it will hide the dashed border (the border is shown on iOS only).
*
* @default false
*/
showBorder?: boolean | undefined;
/**
* If this props is made to true, it will display the native buttons "Save" and "Reset".
*
* @default false
*/
showNativeButtons?: boolean | undefined;
/**
* If this props is made to true, it will display the "x_ _ _ _ _ _ _ _ _ _ _" placeholder indicating where to sign.
*
* @default false
*/
showTitleLabel?: boolean | undefined;
/**
* Change the screen orientation based on boolean value
* "portrait" or "landscape"
*/
viewMode?: "portrait" | "landscape" | undefined;
/**
* sets the max size of the image maintains aspect ratio,
*
* @default 500
*/
maxSize?: number | undefined;
/**
* sets the min stroke size
*
* @default 8 (android) ; 0.004 (iOS)
*/
minStrokeWidth?: number | undefined;
/**
* sets the max stroke size
*
* @default 16 (android) ; 0.03 (iOS)
*/
maxStrokeWidth?: number | undefined;
/**
* Add current date over the result image
*/
enableDate?: boolean | undefined;
/**
* Triggered when saveImage() is called, which return Base64 Encoded String and image file path.
*
* @param params - the file path and encoded png
*/
onSaveEvent?(params: SaveEventParams): void;
/**
* Triggered when user marks their signature on the canvas.
* This will not be called when the user does not perform any action on canvas.
*
* @param event - the event when a drag is performed
*/
onDragEvent?(event: any): void;
}
export interface SaveEventParams {
/**
* The file path name
*/
pathName: string;
/**
* The base64 encoded png
*/
encoded: string;
}
declare class SignatureCapture extends Component<SignatureCaptureProps> {
/**
* When called it will save the image and returns the base 64 encoded string on onSaveEvent() callback
*/
saveImage(): void;
/**
* When called it will clear the image on the canvas
*/
resetImage(): void;
}
export default SignatureCapture;