forked from Expensify/react-native-picker-select
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
110 lines (97 loc) · 3.47 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
import {
ModalProps,
ScrollView,
TextInputProps,
TextStyle,
TouchableOpacityProps,
ViewStyle,
} 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'>;
// '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.ReactNode;
InputAccessoryView?: React.ReactNode;
scrollViewRef?: React.RefObject<ScrollView>;
scrollViewContentOffsetY?: number;
darkTheme?: boolean;
}
declare class Picker extends React.Component<PickerSelectProps> {
togglePicker: (animate?: boolean, postToggleCallback?: () => void) => void;
}
export default Picker;
type PickerStateProviderProps = {
readonly children: React.ReactChild;
};
export const PickerStateProvider: React.ComponentType<PickerStateProviderProps>;
export const PickerAvoidingView: React.ComponentType<React.PropsWithChildren>;