This repository has been archived by the owner on Mar 26, 2024. It is now read-only.
forked from hectahertz/react-native-material-dialog
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.d.ts
175 lines (148 loc) · 3.25 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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
// Type definitions for react-native-material-dialog
// Project: https://github.com/hectahertz/react-native-material-dialog
// Definitions by: Kyle Roach <https://github.com/iRoachie>
// TypeScript Version: 2.2.2
import React from "react";
interface MaterialDialogStatic extends Dialog {
/**
* Content of the dialog
*/
children?: JSX.Element;
}
interface PickerItem {
/**
* Text shown to the user for the item
*/
label: string;
/**
* The value retured when the user selects this item
*/
value: string;
}
interface SelectedItem {
/**
* The item selected at the time
*/
selectedItem: PickerItem;
}
interface SelectedItems {
/**
* The items selected at the time
*/
selectedItems: PickerItem[];
}
interface Dialog {
/**
* Title text for the dialog
*
* Default value is null
*/
title?: string;
/**
* Color of the title text
*
* Default is 'rgba(0, 0, 0, 0.87)'
*/
titleColor?: string;
/**
* Accent color used on the buttons and elements
*
* Default is '#51BC78'
*/
colorAccent?: string;
/**
* Text for the confirm button
*
* Default value is 'OK'
*/
okLabel?: string;
/**
* Text for the cancel button
*
* Default value is 'CANCEL'
*/
cancelLabel?: string;
/**
* Determines if the dialog is showing or not
*/
visible: boolean;
/**
* Determines if the form is in scrolled mode
*
* Default is false
*/
scrolled?: boolean;
}
interface MaterialDialogStatic extends Dialog {
/**
* Content of the dialog
*/
children?: JSX.Element;
/**
* Callback function fired when the confirm(ok) button is pressed
* @param selected
*/
onOk?(): void;
/**
* Callback function fired when the cancel button is pressed
* @param selected
*/
onCancel?(): void;
}
interface PickerItem {
/**
* Text shown to the user for the item
*/
label: string;
/**
* The value retured when the user selects this item
*/
value: string;
}
interface SinglePickerMaterialDialogStatic extends Dialog {
/**
* List of items shown to the user to select from
*/
items: PickerItem[];
/**
* Currently selected item chosen from the items array
*/
selectedItem: PickerItem;
/**
* Callback function fired when the confirm(ok) button is pressed
* @param selected
*/
onOk?(selected: SelectedItem): void;
/**
* Callback function fired when the cancel button is pressed
* @param selected
*/
onCancel?(): void;
}
interface MultiPickerMaterialDialogStatic extends Dialog {
/**
* List of items shown to the user to select from
*/
items: PickerItem[];
/**
* Currently selected items chosen from the items array
*/
selectedItems: PickerItem[];
/**
* Callback function fired when the confirm(ok) button is pressed
* @param selected
*/
onOk?(selected: SelectedItems): void;
/**
* Callback function fired when the cancel button is pressed
* @param selected
*/
onCancel?(): void;
}
export class MaterialDialog extends React.Component<MaterialDialogStatic> {}
export class SinglePickerMaterialDialog extends React.Component<
SinglePickerMaterialDialogStatic
> {}
export class MultiPickerMaterialDialog extends React.Component<
MultiPickerMaterialDialogStatic
> {}