Skip to content

Commit 5c8d95b

Browse files
RSNarafacebook-github-bot
authored andcommitted
Make remaining FBiOS/FB4A components export SVCs via __INTERNAL_VIEW_CONFIG
Summary: The static ViewConfig codegen generates the static ViewConfig inside the JavaScript module [under an exported constant](https://github.com/facebook/react-native/blob/a0a2958cdac767f50084c2d5bee6cf224ffb9db3/packages/react-native-codegen/src/generators/components/GenerateViewConfigJs.js#L127-L129): ``` export const __INTERNAL_VIEW_CONFIG = VIEW_CONFIG; export default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG); ``` This exported constant allows us to build a test page that requires all components, and compares their static ViewConfigs with their native ViewConfig. This diff makes components with hand-written static ViewConfigs also export this __INTERNAL_VIEW_CONFIG const. Changelog: [Internal] Reviewed By: p-sun Differential Revision: D34541868 fbshipit-source-id: f55dd3f1b161038baaf84cbbf75c1f4041c34647
1 parent ec27141 commit 5c8d95b

9 files changed

+249
-192
lines changed

Libraries/Components/ScrollView/AndroidHorizontalScrollViewNativeComponent.js

+46-38
Original file line numberDiff line numberDiff line change
@@ -9,46 +9,54 @@
99
*/
1010

1111
import type {ScrollViewNativeProps as Props} from './ScrollViewNativeComponentType';
12-
import type {HostComponent} from '../../Renderer/shims/ReactNativeTypes';
12+
import type {
13+
HostComponent,
14+
PartialViewConfig,
15+
} from '../../Renderer/shims/ReactNativeTypes';
1316
import * as NativeComponentRegistry from '../../NativeComponent/NativeComponentRegistry';
1417

18+
export const __INTERNAL_VIEW_CONFIG: PartialViewConfig = {
19+
uiViewClassName: 'AndroidHorizontalScrollView',
20+
bubblingEventTypes: {},
21+
directEventTypes: {},
22+
validAttributes: {
23+
decelerationRate: true,
24+
disableIntervalMomentum: true,
25+
endFillColor: {process: require('../../StyleSheet/processColor')},
26+
fadingEdgeLength: true,
27+
nestedScrollEnabled: true,
28+
overScrollMode: true,
29+
pagingEnabled: true,
30+
persistentScrollbar: true,
31+
scrollEnabled: true,
32+
scrollPerfTag: true,
33+
sendMomentumEvents: true,
34+
showsHorizontalScrollIndicator: true,
35+
snapToAlignment: true,
36+
snapToEnd: true,
37+
snapToInterval: true,
38+
snapToStart: true,
39+
snapToOffsets: true,
40+
contentOffset: true,
41+
borderBottomLeftRadius: true,
42+
borderBottomRightRadius: true,
43+
borderRadius: true,
44+
borderStyle: true,
45+
borderRightColor: {process: require('../../StyleSheet/processColor')},
46+
borderColor: {process: require('../../StyleSheet/processColor')},
47+
borderBottomColor: {process: require('../../StyleSheet/processColor')},
48+
borderTopLeftRadius: true,
49+
borderTopColor: {process: require('../../StyleSheet/processColor')},
50+
removeClippedSubviews: true,
51+
borderTopRightRadius: true,
52+
borderLeftColor: {process: require('../../StyleSheet/processColor')},
53+
},
54+
};
55+
1556
const AndroidHorizontalScrollViewNativeComponent: HostComponent<Props> =
16-
NativeComponentRegistry.get<Props>('AndroidHorizontalScrollView', () => ({
17-
uiViewClassName: 'AndroidHorizontalScrollView',
18-
bubblingEventTypes: {},
19-
directEventTypes: {},
20-
validAttributes: {
21-
decelerationRate: true,
22-
disableIntervalMomentum: true,
23-
endFillColor: {process: require('../../StyleSheet/processColor')},
24-
fadingEdgeLength: true,
25-
nestedScrollEnabled: true,
26-
overScrollMode: true,
27-
pagingEnabled: true,
28-
persistentScrollbar: true,
29-
scrollEnabled: true,
30-
scrollPerfTag: true,
31-
sendMomentumEvents: true,
32-
showsHorizontalScrollIndicator: true,
33-
snapToAlignment: true,
34-
snapToEnd: true,
35-
snapToInterval: true,
36-
snapToStart: true,
37-
snapToOffsets: true,
38-
contentOffset: true,
39-
borderBottomLeftRadius: true,
40-
borderBottomRightRadius: true,
41-
borderRadius: true,
42-
borderStyle: true,
43-
borderRightColor: {process: require('../../StyleSheet/processColor')},
44-
borderColor: {process: require('../../StyleSheet/processColor')},
45-
borderBottomColor: {process: require('../../StyleSheet/processColor')},
46-
borderTopLeftRadius: true,
47-
borderTopColor: {process: require('../../StyleSheet/processColor')},
48-
removeClippedSubviews: true,
49-
borderTopRightRadius: true,
50-
borderLeftColor: {process: require('../../StyleSheet/processColor')},
51-
},
52-
}));
57+
NativeComponentRegistry.get<Props>(
58+
'AndroidHorizontalScrollView',
59+
() => __INTERNAL_VIEW_CONFIG,
60+
);
5361

5462
export default AndroidHorizontalScrollViewNativeComponent;

Libraries/Components/ScrollView/ScrollContentViewNativeComponent.js

+15-7
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,24 @@
88
* @flow
99
*/
1010

11-
import type {HostComponent} from '../../Renderer/shims/ReactNativeTypes';
11+
import type {
12+
HostComponent,
13+
PartialViewConfig,
14+
} from '../../Renderer/shims/ReactNativeTypes';
1215
import * as NativeComponentRegistry from '../../NativeComponent/NativeComponentRegistry';
1316
import type {ViewProps as Props} from '../View/ViewPropTypes';
1417

18+
export const __INTERNAL_VIEW_CONFIG: PartialViewConfig = {
19+
uiViewClassName: 'RCTScrollContentView',
20+
bubblingEventTypes: {},
21+
directEventTypes: {},
22+
validAttributes: {},
23+
};
24+
1525
const ScrollContentViewNativeComponent: HostComponent<Props> =
16-
NativeComponentRegistry.get<Props>('RCTScrollContentView', () => ({
17-
uiViewClassName: 'RCTScrollContentView',
18-
bubblingEventTypes: {},
19-
directEventTypes: {},
20-
validAttributes: {},
21-
}));
26+
NativeComponentRegistry.get<Props>(
27+
'RCTScrollContentView',
28+
() => __INTERNAL_VIEW_CONFIG,
29+
);
2230

2331
export default ScrollContentViewNativeComponent;

Libraries/Components/ScrollView/ScrollViewNativeComponent.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,15 @@
99
*/
1010

1111
import type {ScrollViewNativeProps as Props} from './ScrollViewNativeComponentType';
12-
import type {HostComponent} from '../../Renderer/shims/ReactNativeTypes';
12+
import type {
13+
HostComponent,
14+
PartialViewConfig,
15+
} from '../../Renderer/shims/ReactNativeTypes';
1316
import * as NativeComponentRegistry from '../../NativeComponent/NativeComponentRegistry';
1417
import {ConditionallyIgnoredEventHandlers} from '../../NativeComponent/ViewConfigIgnore';
1518
import Platform from '../../Utilities/Platform';
1619

17-
const RCTScrollViewViewConfig =
20+
export const __INTERNAL_VIEW_CONFIG: PartialViewConfig =
1821
Platform.OS === 'android'
1922
? {
2023
uiViewClassName: 'RCTScrollView',
@@ -153,7 +156,7 @@ const RCTScrollViewViewConfig =
153156
const ScrollViewNativeComponent: HostComponent<Props> =
154157
NativeComponentRegistry.get<Props>(
155158
'RCTScrollView',
156-
() => RCTScrollViewViewConfig,
159+
() => __INTERNAL_VIEW_CONFIG,
157160
);
158161

159162
export default ScrollViewNativeComponent;

Libraries/Components/TextInput/AndroidTextInputNativeComponent.js

+114-109
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ import type {
1717
Int32,
1818
WithDefault,
1919
} from '../../Types/CodegenTypes';
20-
import type {HostComponent} from '../../Renderer/shims/ReactNativeTypes';
20+
import type {
21+
HostComponent,
22+
PartialViewConfig,
23+
} from '../../Renderer/shims/ReactNativeTypes';
2124
import type {
2225
TextStyleProp,
2326
ViewStyleProp,
@@ -593,123 +596,125 @@ export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
593596
supportedCommands: ['focus', 'blur', 'setTextAndSelection'],
594597
});
595598

596-
let AndroidTextInputNativeComponent = NativeComponentRegistry.get<NativeProps>(
597-
'AndroidTextInput',
598-
() => ({
599-
uiViewClassName: 'AndroidTextInput',
600-
bubblingEventTypes: {
601-
topBlur: {
602-
phasedRegistrationNames: {
603-
bubbled: 'onBlur',
604-
captured: 'onBlurCapture',
605-
},
606-
},
607-
topEndEditing: {
608-
phasedRegistrationNames: {
609-
bubbled: 'onEndEditing',
610-
captured: 'onEndEditingCapture',
611-
},
599+
export const __INTERNAL_VIEW_CONFIG: PartialViewConfig = {
600+
uiViewClassName: 'AndroidTextInput',
601+
bubblingEventTypes: {
602+
topBlur: {
603+
phasedRegistrationNames: {
604+
bubbled: 'onBlur',
605+
captured: 'onBlurCapture',
612606
},
613-
topFocus: {
614-
phasedRegistrationNames: {
615-
bubbled: 'onFocus',
616-
captured: 'onFocusCapture',
617-
},
618-
},
619-
topKeyPress: {
620-
phasedRegistrationNames: {
621-
bubbled: 'onKeyPress',
622-
captured: 'onKeyPressCapture',
623-
},
607+
},
608+
topEndEditing: {
609+
phasedRegistrationNames: {
610+
bubbled: 'onEndEditing',
611+
captured: 'onEndEditingCapture',
624612
},
625-
topSubmitEditing: {
626-
phasedRegistrationNames: {
627-
bubbled: 'onSubmitEditing',
628-
captured: 'onSubmitEditingCapture',
629-
},
613+
},
614+
topFocus: {
615+
phasedRegistrationNames: {
616+
bubbled: 'onFocus',
617+
captured: 'onFocusCapture',
630618
},
631-
topTextInput: {
632-
phasedRegistrationNames: {
633-
bubbled: 'onTextInput',
634-
captured: 'onTextInputCapture',
635-
},
619+
},
620+
topKeyPress: {
621+
phasedRegistrationNames: {
622+
bubbled: 'onKeyPress',
623+
captured: 'onKeyPressCapture',
636624
},
637625
},
638-
directEventTypes: {
639-
topScroll: {
640-
registrationName: 'onScroll',
626+
topSubmitEditing: {
627+
phasedRegistrationNames: {
628+
bubbled: 'onSubmitEditing',
629+
captured: 'onSubmitEditingCapture',
641630
},
642631
},
643-
validAttributes: {
644-
maxFontSizeMultiplier: true,
645-
adjustsFontSizeToFit: true,
646-
minimumFontScale: true,
647-
autoFocus: true,
648-
placeholder: true,
649-
inlineImagePadding: true,
650-
contextMenuHidden: true,
651-
textShadowColor: {process: require('../../StyleSheet/processColor')},
652-
maxLength: true,
653-
selectTextOnFocus: true,
654-
textShadowRadius: true,
655-
underlineColorAndroid: {
656-
process: require('../../StyleSheet/processColor'),
632+
topTextInput: {
633+
phasedRegistrationNames: {
634+
bubbled: 'onTextInput',
635+
captured: 'onTextInputCapture',
657636
},
658-
textDecorationLine: true,
659-
blurOnSubmit: true,
660-
textAlignVertical: true,
661-
fontStyle: true,
662-
textShadowOffset: true,
663-
selectionColor: {process: require('../../StyleSheet/processColor')},
664-
selection: true,
665-
placeholderTextColor: {process: require('../../StyleSheet/processColor')},
666-
importantForAutofill: true,
667-
lineHeight: true,
668-
textTransform: true,
669-
returnKeyType: true,
670-
keyboardType: true,
671-
multiline: true,
672-
color: {process: require('../../StyleSheet/processColor')},
673-
autoComplete: true,
674-
numberOfLines: true,
675-
letterSpacing: true,
676-
returnKeyLabel: true,
677-
fontSize: true,
678-
onKeyPress: true,
679-
cursorColor: {process: require('../../StyleSheet/processColor')},
680-
text: true,
681-
showSoftInputOnFocus: true,
682-
textAlign: true,
683-
autoCapitalize: true,
684-
autoCorrect: true,
685-
caretHidden: true,
686-
secureTextEntry: true,
687-
textBreakStrategy: true,
688-
onScroll: true,
689-
onContentSizeChange: true,
690-
disableFullscreenUI: true,
691-
includeFontPadding: true,
692-
fontWeight: true,
693-
fontFamily: true,
694-
allowFontScaling: true,
695-
onSelectionChange: true,
696-
mostRecentEventCount: true,
697-
inlineImageLeft: true,
698-
editable: true,
699-
fontVariant: true,
700-
borderBottomRightRadius: true,
701-
borderBottomColor: {process: require('../../StyleSheet/processColor')},
702-
borderRadius: true,
703-
borderRightColor: {process: require('../../StyleSheet/processColor')},
704-
borderColor: {process: require('../../StyleSheet/processColor')},
705-
borderTopRightRadius: true,
706-
borderStyle: true,
707-
borderBottomLeftRadius: true,
708-
borderLeftColor: {process: require('../../StyleSheet/processColor')},
709-
borderTopLeftRadius: true,
710-
borderTopColor: {process: require('../../StyleSheet/processColor')},
711637
},
712-
}),
638+
},
639+
directEventTypes: {
640+
topScroll: {
641+
registrationName: 'onScroll',
642+
},
643+
},
644+
validAttributes: {
645+
maxFontSizeMultiplier: true,
646+
adjustsFontSizeToFit: true,
647+
minimumFontScale: true,
648+
autoFocus: true,
649+
placeholder: true,
650+
inlineImagePadding: true,
651+
contextMenuHidden: true,
652+
textShadowColor: {process: require('../../StyleSheet/processColor')},
653+
maxLength: true,
654+
selectTextOnFocus: true,
655+
textShadowRadius: true,
656+
underlineColorAndroid: {
657+
process: require('../../StyleSheet/processColor'),
658+
},
659+
textDecorationLine: true,
660+
blurOnSubmit: true,
661+
textAlignVertical: true,
662+
fontStyle: true,
663+
textShadowOffset: true,
664+
selectionColor: {process: require('../../StyleSheet/processColor')},
665+
selection: true,
666+
placeholderTextColor: {process: require('../../StyleSheet/processColor')},
667+
importantForAutofill: true,
668+
lineHeight: true,
669+
textTransform: true,
670+
returnKeyType: true,
671+
keyboardType: true,
672+
multiline: true,
673+
color: {process: require('../../StyleSheet/processColor')},
674+
autoComplete: true,
675+
numberOfLines: true,
676+
letterSpacing: true,
677+
returnKeyLabel: true,
678+
fontSize: true,
679+
onKeyPress: true,
680+
cursorColor: {process: require('../../StyleSheet/processColor')},
681+
text: true,
682+
showSoftInputOnFocus: true,
683+
textAlign: true,
684+
autoCapitalize: true,
685+
autoCorrect: true,
686+
caretHidden: true,
687+
secureTextEntry: true,
688+
textBreakStrategy: true,
689+
onScroll: true,
690+
onContentSizeChange: true,
691+
disableFullscreenUI: true,
692+
includeFontPadding: true,
693+
fontWeight: true,
694+
fontFamily: true,
695+
allowFontScaling: true,
696+
onSelectionChange: true,
697+
mostRecentEventCount: true,
698+
inlineImageLeft: true,
699+
editable: true,
700+
fontVariant: true,
701+
borderBottomRightRadius: true,
702+
borderBottomColor: {process: require('../../StyleSheet/processColor')},
703+
borderRadius: true,
704+
borderRightColor: {process: require('../../StyleSheet/processColor')},
705+
borderColor: {process: require('../../StyleSheet/processColor')},
706+
borderTopRightRadius: true,
707+
borderStyle: true,
708+
borderBottomLeftRadius: true,
709+
borderLeftColor: {process: require('../../StyleSheet/processColor')},
710+
borderTopLeftRadius: true,
711+
borderTopColor: {process: require('../../StyleSheet/processColor')},
712+
},
713+
};
714+
715+
let AndroidTextInputNativeComponent = NativeComponentRegistry.get<NativeProps>(
716+
'AndroidTextInput',
717+
() => __INTERNAL_VIEW_CONFIG,
713718
);
714719

715720
// flowlint-next-line unclear-type:off

0 commit comments

Comments
 (0)