File tree Expand file tree Collapse file tree 2 files changed +54
-4
lines changed
Libraries/Components/Picker Expand file tree Collapse file tree 2 files changed +54
-4
lines changed Original file line number Diff line number Diff line change 1111'use strict' ;
1212
1313const requireNativeComponent = require ( '../../ReactNative/requireNativeComponent' ) ;
14+ const ReactNativeViewConfigRegistry = require ( '../../Renderer/shims/ReactNativeViewConfigRegistry' ) ;
1415
1516import type { HostComponent } from '../../Renderer/shims/ReactNativeTypes' ;
1617import type { SyntheticEvent } from '../../Types/CoreEventTypes' ;
1718import type { TextStyleProp } from '../../StyleSheet/StyleSheet' ;
1819import type { ProcessedColorValue } from '../../StyleSheet/processColor' ;
1920import codegenNativeCommands from '../../Utilities/codegenNativeCommands' ;
21+ import RCTPickerViewConfig from './RCTPickerViewConfig' ;
2022import * as React from 'react' ;
2123
2224type PickerIOSChangeEvent = SyntheticEvent <
@@ -56,8 +58,15 @@ export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
5658 supportedCommands : [ 'setNativeSelectedIndex' ] ,
5759} ) ;
5860
59- const RCTPickerNativeComponent : ComponentType = requireNativeComponent < NativeProps > (
60- 'RCTPicker' ,
61- ) ;
61+ let RCTPickerNativeComponent ;
62+ if ( global . RN$Bridgeless ) {
63+ ReactNativeViewConfigRegistry . register ( 'RCTPicker' , ( ) => {
64+ return RCTPickerViewConfig ;
65+ } ) ;
66+ RCTPickerNativeComponent = 'RCTPicker' ;
67+ } else {
68+ RCTPickerNativeComponent = requireNativeComponent < NativeProps > ( 'RCTPicker' ) ;
69+ }
6270
63- export default RCTPickerNativeComponent ;
71+ // flowlint-next-line unclear-type:off
72+ export default ( ( RCTPickerNativeComponent : any ) : HostComponent < NativeProps > ) ;
Original file line number Diff line number Diff line change 1+ /**
2+ * Copyright (c) Facebook, Inc. and its affiliates.
3+ *
4+ * This source code is licensed under the MIT license found in the
5+ * LICENSE file in the root directory of this source tree.
6+ *
7+ * @flow strict-local
8+ * @format
9+ */
10+
11+ 'use strict' ;
12+
13+ import ReactNativeViewViewConfig from '../../Components/View/ReactNativeViewViewConfig' ;
14+ import type { ReactNativeBaseComponentViewConfig } from '../../Renderer/shims/ReactNativeTypes' ;
15+
16+ const RCTPickerViewConfig = {
17+ uiViewClassName : 'RCTPicker' ,
18+ bubblingEventTypes : {
19+ topChange : {
20+ phasedRegistrationNames : {
21+ bubbled : 'onChange' ,
22+ captured : 'onChangeCapture' ,
23+ } ,
24+ } ,
25+ } ,
26+ directEventTypes : { } ,
27+ validAttributes : {
28+ ...ReactNativeViewViewConfig . validAttributes ,
29+ color : { process : require ( '../../StyleSheet/processColor' ) } ,
30+ fontFamily : true ,
31+ fontSize : true ,
32+ fontStyle : true ,
33+ fontWeight : true ,
34+ items : true ,
35+ onChange : true ,
36+ selectedIndex : true ,
37+ textAlign : true ,
38+ } ,
39+ } ;
40+
41+ module . exports = ( RCTPickerViewConfig : ReactNativeBaseComponentViewConfig < > ) ;
You can’t perform that action at this time.
0 commit comments