-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.d.ts
200 lines (198 loc) · 5.54 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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
import type * as React from 'react';
import { StyleProp, ViewStyle, TextStyle } from 'react-native';
declare module 'react-native-select-dropdown-customized' {
export type SelectDropdownProps = {
/**
* array of data that will be represented in dropdown, can be array of objects
*/
data: Array<any>;
/**
* function recieves selected item and its index in data array
*/
onSelect: (selectedItem: any, index: number) => void;
/**
* default button text when no item is selected
*/
defaultButtonText?: string;
/**
* default selected item in dropdown
*/
defaultValue?: any;
/**
* default selected item index
*/
defaultValueByIndex?: number;
/**
* disable dropdown
*/
disabled?: boolean;
/**
* disable auto scroll to selected value
*/
disableAutoScroll?: boolean;
/**
* disable click all Rows index in the list
*/
disabledIndexs?: number[];
/**
* function fires when dropdown is opened
*/
onFocus?: () => void;
/**
* function fires when dropdown is closed
*/
onBlur?: () => void;
/**
* function fires when dropdown reaches the end
*/
onScrollEndReached?: () => void;
/**
* style object for button
*/
buttonStyle?: StyleProp<ViewStyle>;
/**
* style object for button text
*/
buttonTextStyle?: StyleProp<TextStyle>;
/**
* function that should return a React component for dropdown icon
*/
renderDropdownIcon?: (selectedItem: any, index: number) => React.ReactNode;
/**
* dropdown icon position "left" || "right"
*/
dropdownIconPosition?: 'left' | 'right';
/**
* required to set true when statusbar is translucent (android only)
*/
statusBarTranslucent?: boolean;
/**
* style object for dropdown view
*/
dropdownStyle?: StyleProp<ViewStyle>;
/**
* When true, shows a vertical scroll indicator in the dropdown.
*/
dropdownOverlayColor?: string;
/**
* backdrop color when dropdown is opened
*/
showsVerticalScrollIndicator?: boolean;
/**
* style object for row
*/
rowStyle?: StyleProp<ViewStyle>;
/**
* style object for row text
*/
rowTextStyle?: StyleProp<TextStyle>;
/**
* style object for selected row
*/
selectedRowStyle?: StyleProp<ViewStyle>;
/**
* style object for selected row text
*/
selectedRowTextStyle?: StyleProp<TextStyle>;
/**
* enable search functionality
*/
search?: boolean;
/**
* style object for search input
*/
searchInputStyle?: StyleProp<ViewStyle>;
/**
* text color for search input
*/
searchInputTxtColor?: string;
/**
* text style for search input
*/
searchInputTxtStyle?: StyleProp<TextStyle>;
/**
* placeholder text for search input
*/
searchPlaceHolder?: string;
/**
* text color for search input placeholder
*/
searchPlaceHolderColor?: string;
/**
* function callback when the search input text changes, this will automatically disable the dropdown's internal search to be implemented manually outside the component
*/
onChangeSearchInputText?: (searchText: string) => void;
/**
* function returns React component for search input icon
*/
renderSearchInputLeftIcon?: (
selectedItem: any,
index: number
) => React.ReactNode;
/**
* function returns React component for search input icon
*/
renderSearchInputRightIcon?: (
selectedItem: any,
index: number
) => React.ReactNode;
} & (
| {
/**
* function recieves selected item and its index, this function should return a string that will be represented in button after item is selected
*/
buttonTextAfterSelection: (selectedItem: any, index: number) => string;
}
| {
/**
* function recieves selected item and its index, this function should return a React component as a child for dropdown button buttonStyle should be used for parent button view style.
*/
renderCustomizedButtonChild?: (
selectedItem: any,
index: number
) => React.ReactNode;
}
) &
(
| {
/**
* function recieves item and index for each row in dropdown, this function shoud return a string that will be represented in each row in dropdown
*/
rowTextForSelection: (item: any, index: number) => string;
}
| {
/**
* function recieves item and its index, this function should return React component as a child for customized row rowStyle should be used for parent row view style.
*/
renderCustomizedRowChild?: (
selectedItem: any,
index: number,
isSelected?: boolean
) => React.ReactNode;
}
| {
/**
* This function should return React component as a child for customized row rowStyle should be used for parent row view style.
*/
renderEmptyCustomizedRowChild?: () => React.ReactNode;
}
);
export default class SelectDropdown extends React.Component<SelectDropdownProps> {
/**
* Remove selection & reset it to display defaultButtonText check
*/
reset(): void;
/**
* Open the dropdown.
*/
openDropdown(): void;
/**
* Close the dropdown.
*/
closeDropdown(): void;
/**
* Select index.
*/
selectIndex(index: number): void;
}
}