/
Picker.d.ts
107 lines (95 loc) · 2.91 KB
/
Picker.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
import $3 from "react";
import { TextStyleProp } from "../../StyleSheet/StyleSheet";
import { ColorValue } from "../../StyleSheet/StyleSheetTypes";
declare type PickerItemProps = Readonly<
/*[FLOW2DTS - Warning] This type was an exact object type in the original Flow source.*/
{
/**
* Text to display for this item.
*/
label: string;
/**
* The value to be passed to picker's `onValueChange` callback when
* this item is selected. Can be a string or an integer.
*/
value?: null | undefined | (number | string);
/**
* Color of this item's text.
* @platform android
*/
color?: ColorValue;
/**
* Used to locate the item in end-to-end tests.
*/
testID?: string;
}>;
declare class PickerItem extends $3.Component<PickerItemProps> {
render(): never;
}
declare type PickerProps = Readonly<
/*[FLOW2DTS - Warning] This type was an exact object type in the original Flow source.*/
{
children?: $3.Node;
style?: null | undefined | TextStyleProp;
/**
* Value matching value of one of the items. Can be a string or an integer.
*/
selectedValue?: null | undefined | (number | string);
/**
* Callback for when an item is selected. This is called with the following parameters:
* - `itemValue`: the `value` prop of the item that was selected
* - `itemIndex`: the index of the selected item in this picker
*/
onValueChange?: null | undefined | ((itemValue: string | number, itemIndex: number) => unknown);
/**
* If set to false, the picker will be disabled, i.e. the user will not be able to make a
* selection.
* @platform android
*/
enabled?: null | undefined | boolean;
/**
* On Android, specifies how to display the selection items when the user taps on the picker:
*
* - 'dialog': Show a modal dialog. This is the default.
* - 'dropdown': Shows a dropdown anchored to the picker view
*
* @platform android
*/
mode?: null | undefined | ("dialog" | "dropdown");
/**
* Style to apply to each of the item labels.
* @platform ios
*/
itemStyle?: null | undefined | TextStyleProp;
/**
* Color of the item background.
* @platform android
*/
backgroundColor?: ColorValue;
/**
* Prompt string for this picker, used on Android in dialog mode as the title of the dialog.
* @platform android
*/
prompt?: null | undefined | string;
/**
* Used to locate this view in end-to-end tests.
*/
testID?: null | undefined | string;
/**
* The string used for the accessibility label. Will be read once focused on the picker but not on change.
*/
accessibilityLabel?: null | undefined | string;
}>;
declare class Picker extends $3.Component<PickerProps> {
static MODE_DIALOG: string;
static MODE_DROPDOWN: string;
static Item: PickerItem;
static defaultProps:
/*[FLOW2DTS - Warning] This type was an exact object type in the original Flow source.*/
{
mode: string;
};
render(): $3.Node;
}
export type { PickerItem };
export default Picker;