forked from lawnstarter/react-native-picker-select
-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathindex.d.ts
More file actions
129 lines (115 loc) · 3.87 KB
/
index.d.ts
File metadata and controls
129 lines (115 loc) · 3.87 KB
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
import {
ModalProps,
ScrollView,
StyleProp,
TextInputProps,
TextStyle,
TouchableOpacityProps,
ViewStyle,
ViewProps,
} from "react-native";
import React from "react";
import { PickerProps } from "@react-native-picker/picker/typings/Picker";
export interface Item {
label: string;
value: any;
key?: string | number;
color?: string;
testID?: string;
/**
* Used when you want a different label displayed
* on the input than what is displayed on the Picker
*
* If falsy, label is used
*/
inputLabel?: string;
}
export interface PickerStyle {
chevron?: StyleProp<ViewStyle>;
chevronDark?: StyleProp<ViewStyle>;
chevronActive?: StyleProp<ViewStyle>;
chevronContainer?: StyleProp<ViewStyle>;
chevronDown?: StyleProp<ViewStyle>;
chevronUp?: StyleProp<ViewStyle>;
done?: StyleProp<TextStyle>;
doneDark?: StyleProp<TextStyle>;
doneDepressed?: StyleProp<TextStyle>;
headlessAndroidContainer?: StyleProp<ViewStyle>;
headlessAndroidPicker?: StyleProp<ViewStyle>;
iconContainer?: StyleProp<ViewStyle>;
inputAndroid?: StyleProp<TextStyle>;
inputAndroidContainer?: StyleProp<ViewStyle>;
inputIOS?: StyleProp<TextStyle>;
inputIOSContainer?: StyleProp<ViewStyle>;
inputWeb?: StyleProp<TextStyle>;
modalViewBottom?: StyleProp<ViewStyle>;
modalViewBottomDark?: StyleProp<ViewStyle>;
modalViewMiddle?: StyleProp<ViewStyle>;
modalViewMiddleDark?: StyleProp<ViewStyle>;
modalViewTop?: StyleProp<ViewStyle>;
placeholder?: StyleProp<TextStyle>;
viewContainer?: StyleProp<ViewStyle>;
}
type CustomModalProps = Omit<
ModalProps,
"visible" | "transparent" | "animationType"
>;
// 'testID', 'supportedOrientations', and 'onOrientationChange' are also used, but can be overwritten safely
type CustomTextInputProps = Omit<
TextInputProps,
"style" | "value" | "ref" | "editable"
>;
// 'testID' is also used, but can be overwritten safely
type CustomPickerProps = Omit<
PickerProps,
"onValueChange" | "selectedValue"
> & {
ref?: React.Ref<Picker>;
};
// 'style' and 'enabled' are also used, but only in headless or native Android mode
// 'testID' is also used, but can be overwritten safely
type CustomTouchableDoneProps = Omit<TouchableOpacityProps, "onPress">;
// 'testID', 'onPressIn', 'onPressOut', and 'hitSlop' are also used, but can be overwritten safely
type CustomTouchableWrapperProps = Omit<TouchableOpacityProps, "onPress">;
// 'testID' and 'activeOpacity' are also used, but can be overwritten safely
export interface PickerSelectProps {
onValueChange: (value: any, index: number) => void;
items: Item[];
value?: any;
placeholder?: Item | {};
disabled?: boolean;
itemKey?: string | number;
style?: PickerStyle;
children?: React.ReactNode;
onOpen?: () => void;
useNativeAndroidPickerStyle?: boolean;
fixAndroidTouchableBug?: boolean;
doneText?: string;
onDonePress?: () => void;
onUpArrow?: () => void;
onDownArrow?: () => void;
onClose?: (donePressed: boolean) => void;
modalProps?: CustomModalProps;
textInputProps?: CustomTextInputProps;
pickerProps?: CustomPickerProps;
touchableDoneProps?: CustomTouchableDoneProps;
touchableWrapperProps?: CustomTouchableWrapperProps;
Icon?: React.FC;
InputAccessoryView?: React.ReactNode;
scrollViewRef?: React.RefObject<ScrollView>;
scrollViewContentOffsetY?: number;
darkTheme?: boolean;
dropdownItemStyle?: StyleProp<ViewStyle>;
activeItemStyle?: StyleProp<ViewStyle>;
}
declare class Picker extends React.Component<PickerSelectProps> {
togglePicker: (animate?: boolean, postToggleCallback?: () => void) => void;
focus: () => void;
}
export default Picker;
type PickerStateProviderProps = {
readonly children: React.ReactNode;
};
export const PickerStateProvider: React.ComponentType<PickerStateProviderProps>;
type PickerAvoidingViewProps = ViewProps & { enabled?: boolean };
export const PickerAvoidingView: React.ComponentType<PickerAvoidingViewProps>;