diff --git a/Libraries/Components/ScrollView/AndroidHorizontalScrollViewNativeComponent.js b/Libraries/Components/ScrollView/AndroidHorizontalScrollViewNativeComponent.js index c2f29322bcc..4a71580256f 100644 --- a/Libraries/Components/ScrollView/AndroidHorizontalScrollViewNativeComponent.js +++ b/Libraries/Components/ScrollView/AndroidHorizontalScrollViewNativeComponent.js @@ -9,46 +9,54 @@ */ import type {ScrollViewNativeProps as Props} from './ScrollViewNativeComponentType'; -import type {HostComponent} from '../../Renderer/shims/ReactNativeTypes'; +import type { + HostComponent, + PartialViewConfig, +} from '../../Renderer/shims/ReactNativeTypes'; import * as NativeComponentRegistry from '../../NativeComponent/NativeComponentRegistry'; +export const __INTERNAL_VIEW_CONFIG: PartialViewConfig = { + uiViewClassName: 'AndroidHorizontalScrollView', + bubblingEventTypes: {}, + directEventTypes: {}, + validAttributes: { + decelerationRate: true, + disableIntervalMomentum: true, + endFillColor: {process: require('../../StyleSheet/processColor')}, + fadingEdgeLength: true, + nestedScrollEnabled: true, + overScrollMode: true, + pagingEnabled: true, + persistentScrollbar: true, + scrollEnabled: true, + scrollPerfTag: true, + sendMomentumEvents: true, + showsHorizontalScrollIndicator: true, + snapToAlignment: true, + snapToEnd: true, + snapToInterval: true, + snapToStart: true, + snapToOffsets: true, + contentOffset: true, + borderBottomLeftRadius: true, + borderBottomRightRadius: true, + borderRadius: true, + borderStyle: true, + borderRightColor: {process: require('../../StyleSheet/processColor')}, + borderColor: {process: require('../../StyleSheet/processColor')}, + borderBottomColor: {process: require('../../StyleSheet/processColor')}, + borderTopLeftRadius: true, + borderTopColor: {process: require('../../StyleSheet/processColor')}, + removeClippedSubviews: true, + borderTopRightRadius: true, + borderLeftColor: {process: require('../../StyleSheet/processColor')}, + }, +}; + const AndroidHorizontalScrollViewNativeComponent: HostComponent = - NativeComponentRegistry.get('AndroidHorizontalScrollView', () => ({ - uiViewClassName: 'AndroidHorizontalScrollView', - bubblingEventTypes: {}, - directEventTypes: {}, - validAttributes: { - decelerationRate: true, - disableIntervalMomentum: true, - endFillColor: {process: require('../../StyleSheet/processColor')}, - fadingEdgeLength: true, - nestedScrollEnabled: true, - overScrollMode: true, - pagingEnabled: true, - persistentScrollbar: true, - scrollEnabled: true, - scrollPerfTag: true, - sendMomentumEvents: true, - showsHorizontalScrollIndicator: true, - snapToAlignment: true, - snapToEnd: true, - snapToInterval: true, - snapToStart: true, - snapToOffsets: true, - contentOffset: true, - borderBottomLeftRadius: true, - borderBottomRightRadius: true, - borderRadius: true, - borderStyle: true, - borderRightColor: {process: require('../../StyleSheet/processColor')}, - borderColor: {process: require('../../StyleSheet/processColor')}, - borderBottomColor: {process: require('../../StyleSheet/processColor')}, - borderTopLeftRadius: true, - borderTopColor: {process: require('../../StyleSheet/processColor')}, - removeClippedSubviews: true, - borderTopRightRadius: true, - borderLeftColor: {process: require('../../StyleSheet/processColor')}, - }, - })); + NativeComponentRegistry.get( + 'AndroidHorizontalScrollView', + () => __INTERNAL_VIEW_CONFIG, + ); export default AndroidHorizontalScrollViewNativeComponent; diff --git a/Libraries/Components/ScrollView/ScrollContentViewNativeComponent.js b/Libraries/Components/ScrollView/ScrollContentViewNativeComponent.js index 30a10939bf4..09038e84ff0 100644 --- a/Libraries/Components/ScrollView/ScrollContentViewNativeComponent.js +++ b/Libraries/Components/ScrollView/ScrollContentViewNativeComponent.js @@ -8,16 +8,24 @@ * @flow */ -import type {HostComponent} from '../../Renderer/shims/ReactNativeTypes'; +import type { + HostComponent, + PartialViewConfig, +} from '../../Renderer/shims/ReactNativeTypes'; import * as NativeComponentRegistry from '../../NativeComponent/NativeComponentRegistry'; import type {ViewProps as Props} from '../View/ViewPropTypes'; +export const __INTERNAL_VIEW_CONFIG: PartialViewConfig = { + uiViewClassName: 'RCTScrollContentView', + bubblingEventTypes: {}, + directEventTypes: {}, + validAttributes: {}, +}; + const ScrollContentViewNativeComponent: HostComponent = - NativeComponentRegistry.get('RCTScrollContentView', () => ({ - uiViewClassName: 'RCTScrollContentView', - bubblingEventTypes: {}, - directEventTypes: {}, - validAttributes: {}, - })); + NativeComponentRegistry.get( + 'RCTScrollContentView', + () => __INTERNAL_VIEW_CONFIG, + ); export default ScrollContentViewNativeComponent; diff --git a/Libraries/Components/ScrollView/ScrollViewNativeComponent.js b/Libraries/Components/ScrollView/ScrollViewNativeComponent.js index ec2166b7f2b..534b5fefbd3 100644 --- a/Libraries/Components/ScrollView/ScrollViewNativeComponent.js +++ b/Libraries/Components/ScrollView/ScrollViewNativeComponent.js @@ -9,12 +9,15 @@ */ import type {ScrollViewNativeProps as Props} from './ScrollViewNativeComponentType'; -import type {HostComponent} from '../../Renderer/shims/ReactNativeTypes'; +import type { + HostComponent, + PartialViewConfig, +} from '../../Renderer/shims/ReactNativeTypes'; import * as NativeComponentRegistry from '../../NativeComponent/NativeComponentRegistry'; import {ConditionallyIgnoredEventHandlers} from '../../NativeComponent/ViewConfigIgnore'; import Platform from '../../Utilities/Platform'; -const RCTScrollViewViewConfig = +export const __INTERNAL_VIEW_CONFIG: PartialViewConfig = Platform.OS === 'android' ? { uiViewClassName: 'RCTScrollView', @@ -153,7 +156,7 @@ const RCTScrollViewViewConfig = const ScrollViewNativeComponent: HostComponent = NativeComponentRegistry.get( 'RCTScrollView', - () => RCTScrollViewViewConfig, + () => __INTERNAL_VIEW_CONFIG, ); export default ScrollViewNativeComponent; diff --git a/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js b/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js index 26982732c96..e896a77f810 100644 --- a/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js +++ b/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js @@ -17,7 +17,10 @@ import type { Int32, WithDefault, } from '../../Types/CodegenTypes'; -import type {HostComponent} from '../../Renderer/shims/ReactNativeTypes'; +import type { + HostComponent, + PartialViewConfig, +} from '../../Renderer/shims/ReactNativeTypes'; import type { TextStyleProp, ViewStyleProp, @@ -593,123 +596,125 @@ export const Commands: NativeCommands = codegenNativeCommands({ supportedCommands: ['focus', 'blur', 'setTextAndSelection'], }); +export const __INTERNAL_VIEW_CONFIG: PartialViewConfig = { + uiViewClassName: 'AndroidTextInput', + bubblingEventTypes: { + topBlur: { + phasedRegistrationNames: { + bubbled: 'onBlur', + captured: 'onBlurCapture', + }, + }, + topEndEditing: { + phasedRegistrationNames: { + bubbled: 'onEndEditing', + captured: 'onEndEditingCapture', + }, + }, + topFocus: { + phasedRegistrationNames: { + bubbled: 'onFocus', + captured: 'onFocusCapture', + }, + }, + topKeyPress: { + phasedRegistrationNames: { + bubbled: 'onKeyPress', + captured: 'onKeyPressCapture', + }, + }, + topSubmitEditing: { + phasedRegistrationNames: { + bubbled: 'onSubmitEditing', + captured: 'onSubmitEditingCapture', + }, + }, + topTextInput: { + phasedRegistrationNames: { + bubbled: 'onTextInput', + captured: 'onTextInputCapture', + }, + }, + }, + directEventTypes: { + topScroll: { + registrationName: 'onScroll', + }, + }, + validAttributes: { + maxFontSizeMultiplier: true, + adjustsFontSizeToFit: true, + minimumFontScale: true, + autoFocus: true, + placeholder: true, + inlineImagePadding: true, + contextMenuHidden: true, + textShadowColor: {process: require('../../StyleSheet/processColor')}, + maxLength: true, + selectTextOnFocus: true, + textShadowRadius: true, + underlineColorAndroid: { + process: require('../../StyleSheet/processColor'), + }, + textDecorationLine: true, + blurOnSubmit: true, + textAlignVertical: true, + fontStyle: true, + textShadowOffset: true, + selectionColor: {process: require('../../StyleSheet/processColor')}, + selection: true, + placeholderTextColor: {process: require('../../StyleSheet/processColor')}, + importantForAutofill: true, + lineHeight: true, + textTransform: true, + returnKeyType: true, + keyboardType: true, + multiline: true, + color: {process: require('../../StyleSheet/processColor')}, + autoComplete: true, + numberOfLines: true, + letterSpacing: true, + returnKeyLabel: true, + fontSize: true, + onKeyPress: true, + cursorColor: {process: require('../../StyleSheet/processColor')}, + text: true, + showSoftInputOnFocus: true, + textAlign: true, + autoCapitalize: true, + autoCorrect: true, + caretHidden: true, + secureTextEntry: true, + textBreakStrategy: true, + onScroll: true, + onContentSizeChange: true, + disableFullscreenUI: true, + includeFontPadding: true, + fontWeight: true, + fontFamily: true, + allowFontScaling: true, + onSelectionChange: true, + mostRecentEventCount: true, + inlineImageLeft: true, + editable: true, + fontVariant: true, + borderBottomRightRadius: true, + borderBottomColor: {process: require('../../StyleSheet/processColor')}, + borderRadius: true, + borderRightColor: {process: require('../../StyleSheet/processColor')}, + borderColor: {process: require('../../StyleSheet/processColor')}, + borderTopRightRadius: true, + borderStyle: true, + borderBottomLeftRadius: true, + borderLeftColor: {process: require('../../StyleSheet/processColor')}, + borderTopLeftRadius: true, + borderTopColor: {process: require('../../StyleSheet/processColor')}, + }, +}; + let AndroidTextInputNativeComponent = NativeComponentRegistry.get( 'AndroidTextInput', - () => ({ - uiViewClassName: 'AndroidTextInput', - bubblingEventTypes: { - topBlur: { - phasedRegistrationNames: { - bubbled: 'onBlur', - captured: 'onBlurCapture', - }, - }, - topEndEditing: { - phasedRegistrationNames: { - bubbled: 'onEndEditing', - captured: 'onEndEditingCapture', - }, - }, - topFocus: { - phasedRegistrationNames: { - bubbled: 'onFocus', - captured: 'onFocusCapture', - }, - }, - topKeyPress: { - phasedRegistrationNames: { - bubbled: 'onKeyPress', - captured: 'onKeyPressCapture', - }, - }, - topSubmitEditing: { - phasedRegistrationNames: { - bubbled: 'onSubmitEditing', - captured: 'onSubmitEditingCapture', - }, - }, - topTextInput: { - phasedRegistrationNames: { - bubbled: 'onTextInput', - captured: 'onTextInputCapture', - }, - }, - }, - directEventTypes: { - topScroll: { - registrationName: 'onScroll', - }, - }, - validAttributes: { - maxFontSizeMultiplier: true, - adjustsFontSizeToFit: true, - minimumFontScale: true, - autoFocus: true, - placeholder: true, - inlineImagePadding: true, - contextMenuHidden: true, - textShadowColor: {process: require('../../StyleSheet/processColor')}, - maxLength: true, - selectTextOnFocus: true, - textShadowRadius: true, - underlineColorAndroid: { - process: require('../../StyleSheet/processColor'), - }, - textDecorationLine: true, - blurOnSubmit: true, - textAlignVertical: true, - fontStyle: true, - textShadowOffset: true, - selectionColor: {process: require('../../StyleSheet/processColor')}, - selection: true, - placeholderTextColor: {process: require('../../StyleSheet/processColor')}, - importantForAutofill: true, - lineHeight: true, - textTransform: true, - returnKeyType: true, - keyboardType: true, - multiline: true, - color: {process: require('../../StyleSheet/processColor')}, - autoComplete: true, - numberOfLines: true, - letterSpacing: true, - returnKeyLabel: true, - fontSize: true, - onKeyPress: true, - cursorColor: {process: require('../../StyleSheet/processColor')}, - text: true, - showSoftInputOnFocus: true, - textAlign: true, - autoCapitalize: true, - autoCorrect: true, - caretHidden: true, - secureTextEntry: true, - textBreakStrategy: true, - onScroll: true, - onContentSizeChange: true, - disableFullscreenUI: true, - includeFontPadding: true, - fontWeight: true, - fontFamily: true, - allowFontScaling: true, - onSelectionChange: true, - mostRecentEventCount: true, - inlineImageLeft: true, - editable: true, - fontVariant: true, - borderBottomRightRadius: true, - borderBottomColor: {process: require('../../StyleSheet/processColor')}, - borderRadius: true, - borderRightColor: {process: require('../../StyleSheet/processColor')}, - borderColor: {process: require('../../StyleSheet/processColor')}, - borderTopRightRadius: true, - borderStyle: true, - borderBottomLeftRadius: true, - borderLeftColor: {process: require('../../StyleSheet/processColor')}, - borderTopLeftRadius: true, - borderTopColor: {process: require('../../StyleSheet/processColor')}, - }, - }), + () => __INTERNAL_VIEW_CONFIG, ); // flowlint-next-line unclear-type:off diff --git a/Libraries/Components/TextInput/RCTMultilineTextInputNativeComponent.js b/Libraries/Components/TextInput/RCTMultilineTextInputNativeComponent.js index e43950b51cb..9c42d59cacb 100644 --- a/Libraries/Components/TextInput/RCTMultilineTextInputNativeComponent.js +++ b/Libraries/Components/TextInput/RCTMultilineTextInputNativeComponent.js @@ -8,7 +8,10 @@ * @format */ -import type {HostComponent} from '../../Renderer/shims/ReactNativeTypes'; +import type { + HostComponent, + PartialViewConfig, +} from '../../Renderer/shims/ReactNativeTypes'; import codegenNativeCommands from '../../Utilities/codegenNativeCommands'; import type {TextInputNativeCommands} from './TextInputNativeCommands'; import RCTTextInputViewConfig from './RCTTextInputViewConfig'; @@ -22,15 +25,20 @@ export const Commands: NativeCommands = codegenNativeCommands({ supportedCommands: ['focus', 'blur', 'setTextAndSelection'], }); +export const __INTERNAL_VIEW_CONFIG: PartialViewConfig = { + uiViewClassName: 'RCTMultilineTextInputView', + ...RCTTextInputViewConfig, + validAttributes: { + ...RCTTextInputViewConfig.validAttributes, + dataDetectorTypes: true, + }, +}; + const MultilineTextInputNativeComponent: HostComponent = - NativeComponentRegistry.get('RCTMultilineTextInputView', () => ({ - uiViewClassName: 'RCTMultilineTextInputView', - ...RCTTextInputViewConfig, - validAttributes: { - ...RCTTextInputViewConfig.validAttributes, - dataDetectorTypes: true, - }, - })); + NativeComponentRegistry.get( + 'RCTMultilineTextInputView', + () => __INTERNAL_VIEW_CONFIG, + ); // flowlint-next-line unclear-type:off export default ((MultilineTextInputNativeComponent: any): HostComponent); diff --git a/Libraries/Components/TextInput/RCTSingelineTextInputNativeComponent.js b/Libraries/Components/TextInput/RCTSingelineTextInputNativeComponent.js index 0490d96a111..dfc01c34c54 100644 --- a/Libraries/Components/TextInput/RCTSingelineTextInputNativeComponent.js +++ b/Libraries/Components/TextInput/RCTSingelineTextInputNativeComponent.js @@ -8,7 +8,10 @@ * @format */ -import type {HostComponent} from '../../Renderer/shims/ReactNativeTypes'; +import type { + HostComponent, + PartialViewConfig, +} from '../../Renderer/shims/ReactNativeTypes'; import codegenNativeCommands from '../../Utilities/codegenNativeCommands'; import type {TextInputNativeCommands} from './TextInputNativeCommands'; import RCTTextInputViewConfig from './RCTTextInputViewConfig'; @@ -22,11 +25,16 @@ export const Commands: NativeCommands = codegenNativeCommands({ supportedCommands: ['focus', 'blur', 'setTextAndSelection'], }); +export const __INTERNAL_VIEW_CONFIG: PartialViewConfig = { + uiViewClassName: 'RCTSinglelineTextInputView', + ...RCTTextInputViewConfig, +}; + const SinglelineTextInputNativeComponent: HostComponent = - NativeComponentRegistry.get('RCTSinglelineTextInputView', () => ({ - uiViewClassName: 'RCTSinglelineTextInputView', - ...RCTTextInputViewConfig, - })); + NativeComponentRegistry.get( + 'RCTSinglelineTextInputView', + () => __INTERNAL_VIEW_CONFIG, + ); // flowlint-next-line unclear-type:off export default ((SinglelineTextInputNativeComponent: any): HostComponent); diff --git a/Libraries/Components/View/ViewNativeComponent.js b/Libraries/Components/View/ViewNativeComponent.js index 378e4a59824..bba9f3971e6 100644 --- a/Libraries/Components/View/ViewNativeComponent.js +++ b/Libraries/Components/View/ViewNativeComponent.js @@ -9,14 +9,17 @@ */ import * as NativeComponentRegistry from '../../NativeComponent/NativeComponentRegistry'; -import {type HostComponent} from '../../Renderer/shims/ReactNativeTypes'; +import type { + HostComponent, + PartialViewConfig, +} from '../../Renderer/shims/ReactNativeTypes'; import codegenNativeCommands from '../../Utilities/codegenNativeCommands'; import {type ViewProps as Props} from './ViewPropTypes'; import Platform from '../../Utilities/Platform'; import * as React from 'react'; -const ViewPartialViewConfig = +export const __INTERNAL_VIEW_CONFIG: PartialViewConfig = Platform.OS === 'android' ? { uiViewClassName: 'RCTView', @@ -78,7 +81,7 @@ const ViewPartialViewConfig = }; const ViewNativeComponent: HostComponent = - NativeComponentRegistry.get('RCTView', () => ViewPartialViewConfig); + NativeComponentRegistry.get('RCTView', () => __INTERNAL_VIEW_CONFIG); interface NativeCommands { +hotspotUpdate: ( diff --git a/Libraries/Image/ImageViewNativeComponent.js b/Libraries/Image/ImageViewNativeComponent.js index 69b21ea2263..ad724a5efb7 100644 --- a/Libraries/Image/ImageViewNativeComponent.js +++ b/Libraries/Image/ImageViewNativeComponent.js @@ -13,7 +13,10 @@ import type {ImageProps} from './ImageProps'; import type {ViewProps} from '../Components/View/ViewPropTypes'; import * as NativeComponentRegistry from '../NativeComponent/NativeComponentRegistry'; import {ConditionallyIgnoredEventHandlers} from '../NativeComponent/ViewConfigIgnore'; -import type {HostComponent} from '../Renderer/shims/ReactNativeTypes'; +import type { + HostComponent, + PartialViewConfig, +} from '../Renderer/shims/ReactNativeTypes'; import type { ColorValue, DangerouslyImpreciseStyle, @@ -38,7 +41,7 @@ type Props = $ReadOnly<{ loadingIndicatorSrc?: ?string, }>; -const ImageViewViewConfig = +export const __INTERNAL_VIEW_CONFIG: PartialViewConfig = Platform.OS === 'android' ? { uiViewClassName: 'RCTImageView', @@ -138,6 +141,9 @@ const ImageViewViewConfig = }; const ImageViewNativeComponent: HostComponent = - NativeComponentRegistry.get('RCTImageView', () => ImageViewViewConfig); + NativeComponentRegistry.get( + 'RCTImageView', + () => __INTERNAL_VIEW_CONFIG, + ); export default ImageViewNativeComponent; diff --git a/Libraries/Image/TextInlineImageNativeComponent.js b/Libraries/Image/TextInlineImageNativeComponent.js index b3b14037689..2ba778b217c 100644 --- a/Libraries/Image/TextInlineImageNativeComponent.js +++ b/Libraries/Image/TextInlineImageNativeComponent.js @@ -10,7 +10,10 @@ 'use strict'; -import type {HostComponent} from '../Renderer/shims/ReactNativeTypes'; +import type { + HostComponent, + PartialViewConfig, +} from '../Renderer/shims/ReactNativeTypes'; import type {ViewProps} from '../Components/View/ViewPropTypes'; import type {ImageResizeMode} from './ImageResizeMode'; import * as NativeComponentRegistry from '../NativeComponent/NativeComponentRegistry'; @@ -24,19 +27,24 @@ type NativeProps = $ReadOnly<{ headers?: ?{[string]: string}, }>; -const TextInlineImage: HostComponent = - NativeComponentRegistry.get('RCTTextInlineImage', () => ({ - uiViewClassName: 'RCTTextInlineImage', - bubblingEventTypes: {}, - directEventTypes: {}, - validAttributes: { - resizeMode: true, - src: true, - tintColor: { - process: require('../StyleSheet/processColor'), - }, - headers: true, +export const __INTERNAL_VIEW_CONFIG: PartialViewConfig = { + uiViewClassName: 'RCTTextInlineImage', + bubblingEventTypes: {}, + directEventTypes: {}, + validAttributes: { + resizeMode: true, + src: true, + tintColor: { + process: require('../StyleSheet/processColor'), }, - })); + headers: true, + }, +}; -module.exports = TextInlineImage; +const TextInlineImage: HostComponent = + NativeComponentRegistry.get( + 'RCTTextInlineImage', + () => __INTERNAL_VIEW_CONFIG, + ); + +export default TextInlineImage;