forked from lawnstarter/react-native-picker-select
-
Notifications
You must be signed in to change notification settings - Fork 10
/
index.d.ts
116 lines (102 loc) · 3.61 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
import {
ModalProps,
ScrollView,
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;
/**
* 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?: ViewStyle;
chevronDark?: ViewStyle;
chevronActive?: ViewStyle;
chevronContainer?: ViewStyle;
chevronDown?: ViewStyle;
chevronUp?: ViewStyle;
done?: TextStyle;
doneDark?: TextStyle;
doneDepressed?: TextStyle;
headlessAndroidContainer?: ViewStyle;
headlessAndroidPicker?: ViewStyle;
iconContainer?: ViewStyle;
inputAndroid?: TextStyle;
inputAndroidContainer?: ViewStyle;
inputIOS?: TextStyle;
inputIOSContainer?: ViewStyle;
inputWeb?: TextStyle;
modalViewBottom?: ViewStyle;
modalViewBottomDark?: ViewStyle;
modalViewMiddle?: ViewStyle;
modalViewMiddleDark?: ViewStyle;
modalViewTop?: ViewStyle;
placeholder?: TextStyle;
viewContainer?: 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.RefObject<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?: () => void;
modalProps?: CustomModalProps;
textInputProps?: CustomTextInputProps;
pickerProps?: CustomPickerProps;
touchableDoneProps?: CustomTouchableDoneProps;
touchableWrapperProps?: CustomTouchableWrapperProps;
Icon?: React.ComponentType;
InputAccessoryView?: React.ReactNode;
scrollViewRef?: React.RefObject<ScrollView>;
scrollViewContentOffsetY?: number;
darkTheme?: boolean;
}
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>;