-
Notifications
You must be signed in to change notification settings - Fork 313
Expand file tree
/
Copy pathAndroidDropdownPickerNativeComponent.js
More file actions
84 lines (73 loc) · 2.28 KB
/
Copy pathAndroidDropdownPickerNativeComponent.js
File metadata and controls
84 lines (73 loc) · 2.28 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
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
* @flow
*/
'use strict';
import * as React from 'react';
import type {ColorValue} from 'react-native/Libraries/StyleSheet/StyleSheet';
import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes';
import type {HostComponent} from 'react-native/Libraries/Renderer/shims/ReactNativeTypes';
import type {
BubblingEventHandler,
Double,
Int32,
} from 'react-native/Libraries/Types/CodegenTypes';
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands';
export type PickerAndroidChangeEvent = $ReadOnly<{|
position: Int32,
|}>;
export type PickerItemStyle = $ReadOnly<{|
backgroundColor?: ?ColorValue,
color?: ?ColorValue,
fontSize?: ?Double,
fontFamily?: ?string,
|}>;
export type PickerItem = $ReadOnly<{|
label: string,
value: ?string,
color?: ColorValue,
fontFamily: ?string,
enabled?: ?boolean,
style?: ?PickerItemStyle,
|}>;
type NativeProps = $ReadOnly<{|
...ViewProps,
items: $ReadOnlyArray<PickerItem>,
color?: ColorValue,
prompt?: ?string,
enabled?: ?boolean,
selected: Int32,
backgroundColor?: Int32,
dropdownIconColor?: Int32,
dropdownIconRippleColor?: Int32,
dropdownIconVisible?: ?boolean,
numberOfLines?: ?Int32,
onSelect?: BubblingEventHandler<PickerAndroidChangeEvent, 'topSelect'>,
onFocus?: BubblingEventHandler<null, 'topFocus'>,
onBlur?: BubblingEventHandler<null, 'topBlur'>,
|}>;
type ComponentType = HostComponent<NativeProps>;
interface NativeCommands {
+focus: (viewRef: React.ElementRef<ComponentType>) => void;
+blur: (viewRef: React.ElementRef<ComponentType>) => void;
+setNativeSelected: (
viewRef: React.ElementRef<ComponentType>,
selected: Int32,
) => void;
}
export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
supportedCommands: ['focus', 'blur', 'setNativeSelected'],
});
export default (codegenNativeComponent<NativeProps>(
'RNCAndroidDropdownPicker',
{
excludedPlatforms: ['iOS'],
interfaceOnly: true,
},
): ComponentType);