From 886fb501bdbd875dcc424723d30ad325e367b1f1 Mon Sep 17 00:00:00 2001 From: Rick Hanlon Date: Fri, 7 Jun 2019 12:23:55 -0700 Subject: [PATCH] RN Codegen] Add registerGeneratedViewConfig Summary: This diff updated the format of generated view configs so that they don't need to spread View props into every config, by adding a new registerGeneratedConfig function which will spread them instead This is a bit of a cleanup of the generated output but is primarily so that the view config babel plugin will not need to rely on object spreading or object.assigns Reviewed By: TheSavior, cpojer Differential Revision: D15517199 fbshipit-source-id: 08e575578177bad12d40ee3dcad9381974b6466d --- .../PullToRefreshViewNativeViewConfig.js | 19 +- .../Utilities/registerGeneratedViewConfig.js | 70 ++++ .../src/generators/GenerateViewConfigJs.js | 53 +-- .../GenerateViewConfigJs-test.js.snap | 341 ++---------------- 4 files changed, 106 insertions(+), 377 deletions(-) create mode 100644 Libraries/Utilities/registerGeneratedViewConfig.js diff --git a/Libraries/Components/RefreshControl/PullToRefreshViewNativeViewConfig.js b/Libraries/Components/RefreshControl/PullToRefreshViewNativeViewConfig.js index f76c8e02dd2..e6157a13b05 100644 --- a/Libraries/Components/RefreshControl/PullToRefreshViewNativeViewConfig.js +++ b/Libraries/Components/RefreshControl/PullToRefreshViewNativeViewConfig.js @@ -10,17 +10,12 @@ 'use strict'; -const ReactNativeViewConfigRegistry = require('../../Renderer/shims/ReactNativeViewConfigRegistry'); -const ReactNativeViewViewConfig = require('../View/ReactNativeViewViewConfig'); -const verifyComponentAttributeEquivalence = require('../../Utilities/verifyComponentAttributeEquivalence'); +const registerGeneratedViewConfig = require('../../Utilities/registerGeneratedViewConfig'); const PullToRefreshViewViewConfig = { uiViewClassName: 'PullToRefreshView', - Commands: {}, bubblingEventTypes: { - ...ReactNativeViewViewConfig.bubblingEventTypes, - topRefresh: { phasedRegistrationNames: { captured: 'onRefreshCapture', @@ -29,12 +24,7 @@ const PullToRefreshViewViewConfig = { }, }, - directEventTypes: { - ...ReactNativeViewViewConfig.directEventTypes, - }, - validAttributes: { - ...ReactNativeViewViewConfig.validAttributes, tintColor: { process: require('../../StyleSheet/processColor') }, titleColor: { process: require('../../StyleSheet/processColor') }, title: true, @@ -43,11 +33,6 @@ const PullToRefreshViewViewConfig = { }, }; -verifyComponentAttributeEquivalence('PullToRefreshView', PullToRefreshViewViewConfig); - -ReactNativeViewConfigRegistry.register( - 'PullToRefreshView', - () => PullToRefreshViewViewConfig, -); +registerGeneratedViewConfig('PullToRefreshView', PullToRefreshViewViewConfig); module.exports = 'PullToRefreshView'; diff --git a/Libraries/Utilities/registerGeneratedViewConfig.js b/Libraries/Utilities/registerGeneratedViewConfig.js new file mode 100644 index 00000000000..ee730308678 --- /dev/null +++ b/Libraries/Utilities/registerGeneratedViewConfig.js @@ -0,0 +1,70 @@ +/** + * 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. + * + * @flow + * @format + */ + +'use strict'; + +const ReactNativeViewConfigRegistry = require('../Renderer/shims/ReactNativeViewConfigRegistry'); +const ReactNativeViewViewConfig = require('../Components/View/ReactNativeViewViewConfig'); +const verifyComponentAttributeEquivalence = require('./verifyComponentAttributeEquivalence'); + +type GeneratedViewConfig = { + uiViewClassName: string, + bubblingEventTypes?: $ReadOnly<{ + [eventName: string]: $ReadOnly<{| + phasedRegistrationNames: $ReadOnly<{| + captured: string, + bubbled: string, + |}>, + |}>, + }>, + directEventTypes?: $ReadOnly<{ + [eventName: string]: $ReadOnly<{| + registrationName: string, + |}>, + }>, + validAttributes?: { + [propName: string]: + | true + | $ReadOnly<{| + diff?: (arg1: any, arg2: any) => boolean, + process?: (arg1: any) => any, + |}>, + }, +}; + +function registerGeneratedViewConfig( + componentName: string, + viewConfig: GeneratedViewConfig, +) { + const mergedViewConfig = { + uiViewClassName: viewConfig.uiViewClassName, + Commands: {}, + bubblingEventTypes: { + ...ReactNativeViewViewConfig.bubblingEventTypes, + ...(viewConfig.bubblingEventTypes || {}), + }, + directEventTypes: { + ...ReactNativeViewViewConfig.directEventTypes, + ...(viewConfig.directEventTypes || {}), + }, + validAttributes: { + ...ReactNativeViewViewConfig.validAttributes, + ...(viewConfig.validAttributes || {}), + }, + }; + + ReactNativeViewConfigRegistry.register(componentName, () => { + verifyComponentAttributeEquivalence(componentName, mergedViewConfig); + + return mergedViewConfig; + }); +} + +module.exports = registerGeneratedViewConfig; diff --git a/packages/react-native-codegen/src/generators/GenerateViewConfigJs.js b/packages/react-native-codegen/src/generators/GenerateViewConfigJs.js index d5e1583ea2b..d5f8cde857f 100644 --- a/packages/react-native-codegen/src/generators/GenerateViewConfigJs.js +++ b/packages/react-native-codegen/src/generators/GenerateViewConfigJs.js @@ -87,12 +87,7 @@ function getReactDiffProcessValue(typeAnnotation) { const componentTemplate = ` const ::_COMPONENT_NAME_::ViewConfig = VIEW_CONFIG; -verifyComponentAttributeEquivalence('::_COMPONENT_NAME_WITH_COMPAT_SUPPORT_::', ::_COMPONENT_NAME_::ViewConfig); - -ReactNativeViewConfigRegistry.register( - '::_COMPONENT_NAME_WITH_COMPAT_SUPPORT_::', - () => ::_COMPONENT_NAME_::ViewConfig, -); +registerGeneratedViewConfig('::_COMPONENT_NAME_WITH_COMPAT_SUPPORT_::', ::_COMPONENT_NAME_::ViewConfig); module.exports = '::_COMPONENT_NAME_WITH_COMPAT_SUPPORT_::';::_COMPAT_COMMENT_:: `.trim(); @@ -159,38 +154,13 @@ function buildViewConfig( const componentProps = component.props; const componentEvents = component.events; - let viewAttributes = null; - let viewEvents = null; - let viewDirectEvents = null; - component.extendsProps.forEach(extendProps => { switch (extendProps.type) { case 'ReactNativeBuiltInType': switch (extendProps.knownTypeName) { case 'ReactNativeCoreViewProps': imports.add( - "const ReactNativeViewViewConfig = require('ReactNativeViewViewConfig');", - ); - - viewAttributes = j.spreadProperty( - j.memberExpression( - j.identifier('ReactNativeViewViewConfig'), - j.identifier('validAttributes'), - ), - ); - - viewEvents = j.spreadProperty( - j.memberExpression( - j.identifier('ReactNativeViewViewConfig'), - j.identifier('bubblingEventTypes'), - ), - ); - - viewDirectEvents = j.spreadProperty( - j.memberExpression( - j.identifier('ReactNativeViewViewConfig'), - j.identifier('directEventTypes'), - ), + "const registerGeneratedViewConfig = require('registerGeneratedViewConfig');", ); return; @@ -205,7 +175,6 @@ function buildViewConfig( }); const validAttributes = j.objectExpression([ - viewAttributes, ...componentProps.map(schemaProp => { return j.property( 'init', @@ -220,8 +189,6 @@ function buildViewConfig( .filter(event => event.bubblingType === 'bubble') .map(generateBubblingEventInfo); - bubblingEventNames.unshift(viewEvents); - const bubblingEvents = bubblingEventNames.length > 0 ? j.property( @@ -235,8 +202,6 @@ function buildViewConfig( .filter(event => event.bubblingType === 'direct') .map(generateDirectEventInfo); - directEventNames.unshift(viewDirectEvents); - const directEvents = directEventNames.length > 0 ? j.property( @@ -246,19 +211,12 @@ function buildViewConfig( ) : null; - const commands = j.property( - 'init', - j.identifier('Commands'), - j.objectExpression([]), - ); - const properties = [ j.property( 'init', j.identifier('uiViewClassName'), j.literal(componentName), ), - commands, bubblingEvents, directEvents, j.property('init', j.identifier('validAttributes'), validAttributes), @@ -273,13 +231,6 @@ module.exports = { const fileName = `${libraryName}NativeViewConfig.js`; const imports: Set = new Set(); - imports.add( - "const ReactNativeViewConfigRegistry = require('ReactNativeViewConfigRegistry');", - ); - imports.add( - "const verifyComponentAttributeEquivalence = require('verifyComponentAttributeEquivalence');", - ); - const moduleResults = Object.keys(schema.modules) .map(moduleName => { const components = schema.modules[moduleName].components; diff --git a/packages/react-native-codegen/src/generators/__tests__/__snapshots__/GenerateViewConfigJs-test.js.snap b/packages/react-native-codegen/src/generators/__tests__/__snapshots__/GenerateViewConfigJs-test.js.snap index 729bfac1050..1fd81850c2b 100644 --- a/packages/react-native-codegen/src/generators/__tests__/__snapshots__/GenerateViewConfigJs-test.js.snap +++ b/packages/react-native-codegen/src/generators/__tests__/__snapshots__/GenerateViewConfigJs-test.js.snap @@ -14,24 +14,12 @@ Map { 'use strict'; -const ReactNativeViewConfigRegistry = require('ReactNativeViewConfigRegistry'); -const ReactNativeViewViewConfig = require('ReactNativeViewViewConfig'); -const verifyComponentAttributeEquivalence = require('verifyComponentAttributeEquivalence'); +const registerGeneratedViewConfig = require('registerGeneratedViewConfig'); const ArrayPropsNativeComponentViewConfig = { uiViewClassName: 'ArrayPropsNativeComponent', - Commands: {}, - - bubblingEventTypes: { - ...ReactNativeViewViewConfig.bubblingEventTypes, - }, - - directEventTypes: { - ...ReactNativeViewViewConfig.directEventTypes, - }, validAttributes: { - ...ReactNativeViewViewConfig.validAttributes, names: true, disableds: true, progress: true, @@ -42,12 +30,7 @@ const ArrayPropsNativeComponentViewConfig = { }, }; -verifyComponentAttributeEquivalence('ArrayPropsNativeComponent', ArrayPropsNativeComponentViewConfig); - -ReactNativeViewConfigRegistry.register( - 'ArrayPropsNativeComponent', - () => ArrayPropsNativeComponentViewConfig, -); +registerGeneratedViewConfig('ArrayPropsNativeComponent', ArrayPropsNativeComponentViewConfig); module.exports = 'ArrayPropsNativeComponent'; ", @@ -68,34 +51,17 @@ Map { 'use strict'; -const ReactNativeViewConfigRegistry = require('ReactNativeViewConfigRegistry'); -const ReactNativeViewViewConfig = require('ReactNativeViewViewConfig'); -const verifyComponentAttributeEquivalence = require('verifyComponentAttributeEquivalence'); +const registerGeneratedViewConfig = require('registerGeneratedViewConfig'); const BooleanPropNativeComponentViewConfig = { uiViewClassName: 'BooleanPropNativeComponent', - Commands: {}, - - bubblingEventTypes: { - ...ReactNativeViewViewConfig.bubblingEventTypes, - }, - - directEventTypes: { - ...ReactNativeViewViewConfig.directEventTypes, - }, validAttributes: { - ...ReactNativeViewViewConfig.validAttributes, disabled: true, }, }; -verifyComponentAttributeEquivalence('BooleanPropNativeComponent', BooleanPropNativeComponentViewConfig); - -ReactNativeViewConfigRegistry.register( - 'BooleanPropNativeComponent', - () => BooleanPropNativeComponentViewConfig, -); +registerGeneratedViewConfig('BooleanPropNativeComponent', BooleanPropNativeComponentViewConfig); module.exports = 'BooleanPropNativeComponent'; ", @@ -116,34 +82,17 @@ Map { 'use strict'; -const ReactNativeViewConfigRegistry = require('ReactNativeViewConfigRegistry'); -const ReactNativeViewViewConfig = require('ReactNativeViewViewConfig'); -const verifyComponentAttributeEquivalence = require('verifyComponentAttributeEquivalence'); +const registerGeneratedViewConfig = require('registerGeneratedViewConfig'); const ColorPropNativeComponentViewConfig = { uiViewClassName: 'ColorPropNativeComponent', - Commands: {}, - - bubblingEventTypes: { - ...ReactNativeViewViewConfig.bubblingEventTypes, - }, - - directEventTypes: { - ...ReactNativeViewViewConfig.directEventTypes, - }, validAttributes: { - ...ReactNativeViewViewConfig.validAttributes, tintColor: { process: require('processColor') }, }, }; -verifyComponentAttributeEquivalence('ColorPropNativeComponent', ColorPropNativeComponentViewConfig); - -ReactNativeViewConfigRegistry.register( - 'ColorPropNativeComponent', - () => ColorPropNativeComponentViewConfig, -); +registerGeneratedViewConfig('ColorPropNativeComponent', ColorPropNativeComponentViewConfig); module.exports = 'ColorPropNativeComponent'; ", @@ -164,34 +113,17 @@ Map { 'use strict'; -const ReactNativeViewConfigRegistry = require('ReactNativeViewConfigRegistry'); -const ReactNativeViewViewConfig = require('ReactNativeViewViewConfig'); -const verifyComponentAttributeEquivalence = require('verifyComponentAttributeEquivalence'); +const registerGeneratedViewConfig = require('registerGeneratedViewConfig'); const EnumPropsNativeComponentViewConfig = { uiViewClassName: 'EnumPropsNativeComponent', - Commands: {}, - - bubblingEventTypes: { - ...ReactNativeViewViewConfig.bubblingEventTypes, - }, - - directEventTypes: { - ...ReactNativeViewViewConfig.directEventTypes, - }, validAttributes: { - ...ReactNativeViewViewConfig.validAttributes, alignment: true, }, }; -verifyComponentAttributeEquivalence('EnumPropsNativeComponent', EnumPropsNativeComponentViewConfig); - -ReactNativeViewConfigRegistry.register( - 'EnumPropsNativeComponent', - () => EnumPropsNativeComponentViewConfig, -); +registerGeneratedViewConfig('EnumPropsNativeComponent', EnumPropsNativeComponentViewConfig); module.exports = 'EnumPropsNativeComponent'; ", @@ -212,17 +144,12 @@ Map { 'use strict'; -const ReactNativeViewConfigRegistry = require('ReactNativeViewConfigRegistry'); -const ReactNativeViewViewConfig = require('ReactNativeViewViewConfig'); -const verifyComponentAttributeEquivalence = require('verifyComponentAttributeEquivalence'); +const registerGeneratedViewConfig = require('registerGeneratedViewConfig'); const EventsNestedObjectNativeComponentViewConfig = { uiViewClassName: 'EventsNestedObjectNativeComponent', - Commands: {}, bubblingEventTypes: { - ...ReactNativeViewViewConfig.bubblingEventTypes, - topChange: { phasedRegistrationNames: { captured: 'onChangeCapture', @@ -231,23 +158,13 @@ const EventsNestedObjectNativeComponentViewConfig = { }, }, - directEventTypes: { - ...ReactNativeViewViewConfig.directEventTypes, - }, - validAttributes: { - ...ReactNativeViewViewConfig.validAttributes, disabled: true, onChange: true, }, }; -verifyComponentAttributeEquivalence('EventsNestedObjectNativeComponent', EventsNestedObjectNativeComponentViewConfig); - -ReactNativeViewConfigRegistry.register( - 'EventsNestedObjectNativeComponent', - () => EventsNestedObjectNativeComponentViewConfig, -); +registerGeneratedViewConfig('EventsNestedObjectNativeComponent', EventsNestedObjectNativeComponentViewConfig); module.exports = 'EventsNestedObjectNativeComponent'; ", @@ -268,17 +185,12 @@ Map { 'use strict'; -const ReactNativeViewConfigRegistry = require('ReactNativeViewConfigRegistry'); -const ReactNativeViewViewConfig = require('ReactNativeViewViewConfig'); -const verifyComponentAttributeEquivalence = require('verifyComponentAttributeEquivalence'); +const registerGeneratedViewConfig = require('registerGeneratedViewConfig'); const EventsNativeComponentViewConfig = { uiViewClassName: 'EventsNativeComponent', - Commands: {}, bubblingEventTypes: { - ...ReactNativeViewViewConfig.bubblingEventTypes, - topChange: { phasedRegistrationNames: { captured: 'onChangeCapture', @@ -295,15 +207,12 @@ const EventsNativeComponentViewConfig = { }, directEventTypes: { - ...ReactNativeViewViewConfig.directEventTypes, - topEventDirect: { registrationName: 'onEventDirect', }, }, validAttributes: { - ...ReactNativeViewViewConfig.validAttributes, disabled: true, onChange: true, onEventDirect: true, @@ -311,12 +220,7 @@ const EventsNativeComponentViewConfig = { }, }; -verifyComponentAttributeEquivalence('EventsNativeComponent', EventsNativeComponentViewConfig); - -ReactNativeViewConfigRegistry.register( - 'EventsNativeComponent', - () => EventsNativeComponentViewConfig, -); +registerGeneratedViewConfig('EventsNativeComponent', EventsNativeComponentViewConfig); module.exports = 'EventsNativeComponent'; ", @@ -337,24 +241,12 @@ Map { 'use strict'; -const ReactNativeViewConfigRegistry = require('ReactNativeViewConfigRegistry'); -const ReactNativeViewViewConfig = require('ReactNativeViewViewConfig'); -const verifyComponentAttributeEquivalence = require('verifyComponentAttributeEquivalence'); +const registerGeneratedViewConfig = require('registerGeneratedViewConfig'); const FloatPropNativeComponentViewConfig = { uiViewClassName: 'FloatPropNativeComponent', - Commands: {}, - - bubblingEventTypes: { - ...ReactNativeViewViewConfig.bubblingEventTypes, - }, - - directEventTypes: { - ...ReactNativeViewViewConfig.directEventTypes, - }, validAttributes: { - ...ReactNativeViewViewConfig.validAttributes, blurRadius: true, blurRadius2: true, blurRadius3: true, @@ -364,12 +256,7 @@ const FloatPropNativeComponentViewConfig = { }, }; -verifyComponentAttributeEquivalence('FloatPropNativeComponent', FloatPropNativeComponentViewConfig); - -ReactNativeViewConfigRegistry.register( - 'FloatPropNativeComponent', - () => FloatPropNativeComponentViewConfig, -); +registerGeneratedViewConfig('FloatPropNativeComponent', FloatPropNativeComponentViewConfig); module.exports = 'FloatPropNativeComponent'; ", @@ -390,34 +277,17 @@ Map { 'use strict'; -const ReactNativeViewConfigRegistry = require('ReactNativeViewConfigRegistry'); -const ReactNativeViewViewConfig = require('ReactNativeViewViewConfig'); -const verifyComponentAttributeEquivalence = require('verifyComponentAttributeEquivalence'); +const registerGeneratedViewConfig = require('registerGeneratedViewConfig'); const ImagePropNativeComponentViewConfig = { uiViewClassName: 'ImagePropNativeComponent', - Commands: {}, - - bubblingEventTypes: { - ...ReactNativeViewViewConfig.bubblingEventTypes, - }, - - directEventTypes: { - ...ReactNativeViewViewConfig.directEventTypes, - }, validAttributes: { - ...ReactNativeViewViewConfig.validAttributes, thumbImage: { process: require('resolveAssetSource') }, }, }; -verifyComponentAttributeEquivalence('ImagePropNativeComponent', ImagePropNativeComponentViewConfig); - -ReactNativeViewConfigRegistry.register( - 'ImagePropNativeComponent', - () => ImagePropNativeComponentViewConfig, -); +registerGeneratedViewConfig('ImagePropNativeComponent', ImagePropNativeComponentViewConfig); module.exports = 'ImagePropNativeComponent'; ", @@ -438,36 +308,19 @@ Map { 'use strict'; -const ReactNativeViewConfigRegistry = require('ReactNativeViewConfigRegistry'); -const ReactNativeViewViewConfig = require('ReactNativeViewViewConfig'); -const verifyComponentAttributeEquivalence = require('verifyComponentAttributeEquivalence'); +const registerGeneratedViewConfig = require('registerGeneratedViewConfig'); const IntegerPropNativeComponentViewConfig = { uiViewClassName: 'IntegerPropNativeComponent', - Commands: {}, - - bubblingEventTypes: { - ...ReactNativeViewViewConfig.bubblingEventTypes, - }, - - directEventTypes: { - ...ReactNativeViewViewConfig.directEventTypes, - }, validAttributes: { - ...ReactNativeViewViewConfig.validAttributes, progress1: true, progress2: true, progress3: true, }, }; -verifyComponentAttributeEquivalence('IntegerPropNativeComponent', IntegerPropNativeComponentViewConfig); - -ReactNativeViewConfigRegistry.register( - 'IntegerPropNativeComponent', - () => IntegerPropNativeComponentViewConfig, -); +registerGeneratedViewConfig('IntegerPropNativeComponent', IntegerPropNativeComponentViewConfig); module.exports = 'IntegerPropNativeComponent'; ", @@ -488,17 +341,12 @@ Map { 'use strict'; -const ReactNativeViewConfigRegistry = require('ReactNativeViewConfigRegistry'); -const ReactNativeViewViewConfig = require('ReactNativeViewViewConfig'); -const verifyComponentAttributeEquivalence = require('verifyComponentAttributeEquivalence'); +const registerGeneratedViewConfig = require('registerGeneratedViewConfig'); const InterfaceOnlyComponentViewConfig = { uiViewClassName: 'RCTInterfaceOnlyComponent', - Commands: {}, bubblingEventTypes: { - ...ReactNativeViewViewConfig.bubblingEventTypes, - topChange: { phasedRegistrationNames: { captured: 'onChangeCapture', @@ -507,23 +355,13 @@ const InterfaceOnlyComponentViewConfig = { }, }, - directEventTypes: { - ...ReactNativeViewViewConfig.directEventTypes, - }, - validAttributes: { - ...ReactNativeViewViewConfig.validAttributes, accessibilityHint: true, onChange: true, }, }; -verifyComponentAttributeEquivalence('RCTInterfaceOnlyComponent', InterfaceOnlyComponentViewConfig); - -ReactNativeViewConfigRegistry.register( - 'RCTInterfaceOnlyComponent', - () => InterfaceOnlyComponentViewConfig, -); +registerGeneratedViewConfig('RCTInterfaceOnlyComponent', InterfaceOnlyComponentViewConfig); module.exports = 'RCTInterfaceOnlyComponent'; // RCT prefix present for paper support ", @@ -544,24 +382,12 @@ Map { 'use strict'; -const ReactNativeViewConfigRegistry = require('ReactNativeViewConfigRegistry'); -const ReactNativeViewViewConfig = require('ReactNativeViewViewConfig'); -const verifyComponentAttributeEquivalence = require('verifyComponentAttributeEquivalence'); +const registerGeneratedViewConfig = require('registerGeneratedViewConfig'); const ImageColorPropNativeComponentViewConfig = { uiViewClassName: 'ImageColorPropNativeComponent', - Commands: {}, - - bubblingEventTypes: { - ...ReactNativeViewViewConfig.bubblingEventTypes, - }, - - directEventTypes: { - ...ReactNativeViewViewConfig.directEventTypes, - }, validAttributes: { - ...ReactNativeViewViewConfig.validAttributes, thumbImage: { process: require('resolveAssetSource') }, color: { process: require('processColor') }, thumbTintColor: { process: require('processColor') }, @@ -569,12 +395,7 @@ const ImageColorPropNativeComponentViewConfig = { }, }; -verifyComponentAttributeEquivalence('ImageColorPropNativeComponent', ImageColorPropNativeComponentViewConfig); - -ReactNativeViewConfigRegistry.register( - 'ImageColorPropNativeComponent', - () => ImageColorPropNativeComponentViewConfig, -); +registerGeneratedViewConfig('ImageColorPropNativeComponent', ImageColorPropNativeComponentViewConfig); module.exports = 'ImageColorPropNativeComponent'; ", @@ -595,34 +416,17 @@ Map { 'use strict'; -const ReactNativeViewConfigRegistry = require('ReactNativeViewConfigRegistry'); -const ReactNativeViewViewConfig = require('ReactNativeViewViewConfig'); -const verifyComponentAttributeEquivalence = require('verifyComponentAttributeEquivalence'); +const registerGeneratedViewConfig = require('registerGeneratedViewConfig'); const PointPropNativeComponentViewConfig = { uiViewClassName: 'PointPropNativeComponent', - Commands: {}, - - bubblingEventTypes: { - ...ReactNativeViewViewConfig.bubblingEventTypes, - }, - - directEventTypes: { - ...ReactNativeViewViewConfig.directEventTypes, - }, validAttributes: { - ...ReactNativeViewViewConfig.validAttributes, startPoint: { diff: require('pointsDiffer') }, }, }; -verifyComponentAttributeEquivalence('PointPropNativeComponent', PointPropNativeComponentViewConfig); - -ReactNativeViewConfigRegistry.register( - 'PointPropNativeComponent', - () => PointPropNativeComponentViewConfig, -); +registerGeneratedViewConfig('PointPropNativeComponent', PointPropNativeComponentViewConfig); module.exports = 'PointPropNativeComponent'; ", @@ -643,34 +447,17 @@ Map { 'use strict'; -const ReactNativeViewConfigRegistry = require('ReactNativeViewConfigRegistry'); -const ReactNativeViewViewConfig = require('ReactNativeViewViewConfig'); -const verifyComponentAttributeEquivalence = require('verifyComponentAttributeEquivalence'); +const registerGeneratedViewConfig = require('registerGeneratedViewConfig'); const StringPropComponentViewConfig = { uiViewClassName: 'StringPropComponent', - Commands: {}, - - bubblingEventTypes: { - ...ReactNativeViewViewConfig.bubblingEventTypes, - }, - - directEventTypes: { - ...ReactNativeViewViewConfig.directEventTypes, - }, validAttributes: { - ...ReactNativeViewViewConfig.validAttributes, accessibilityHint: true, }, }; -verifyComponentAttributeEquivalence('StringPropComponent', StringPropComponentViewConfig); - -ReactNativeViewConfigRegistry.register( - 'StringPropComponent', - () => StringPropComponentViewConfig, -); +registerGeneratedViewConfig('StringPropComponent', StringPropComponentViewConfig); module.exports = 'StringPropComponent'; ", @@ -691,61 +478,29 @@ Map { 'use strict'; -const ReactNativeViewConfigRegistry = require('ReactNativeViewConfigRegistry'); -const ReactNativeViewViewConfig = require('ReactNativeViewViewConfig'); -const verifyComponentAttributeEquivalence = require('verifyComponentAttributeEquivalence'); +const registerGeneratedViewConfig = require('registerGeneratedViewConfig'); const MultiFile1NativeComponentViewConfig = { uiViewClassName: 'MultiFile1NativeComponent', - Commands: {}, - - bubblingEventTypes: { - ...ReactNativeViewViewConfig.bubblingEventTypes, - }, - - directEventTypes: { - ...ReactNativeViewViewConfig.directEventTypes, - }, validAttributes: { - ...ReactNativeViewViewConfig.validAttributes, disabled: true, }, }; -verifyComponentAttributeEquivalence('MultiFile1NativeComponent', MultiFile1NativeComponentViewConfig); - -ReactNativeViewConfigRegistry.register( - 'MultiFile1NativeComponent', - () => MultiFile1NativeComponentViewConfig, -); +registerGeneratedViewConfig('MultiFile1NativeComponent', MultiFile1NativeComponentViewConfig); module.exports = 'MultiFile1NativeComponent'; const MultiFile2NativeComponentViewConfig = { uiViewClassName: 'MultiFile2NativeComponent', - Commands: {}, - - bubblingEventTypes: { - ...ReactNativeViewViewConfig.bubblingEventTypes, - }, - - directEventTypes: { - ...ReactNativeViewViewConfig.directEventTypes, - }, validAttributes: { - ...ReactNativeViewViewConfig.validAttributes, disabled: true, }, }; -verifyComponentAttributeEquivalence('MultiFile2NativeComponent', MultiFile2NativeComponentViewConfig); - -ReactNativeViewConfigRegistry.register( - 'MultiFile2NativeComponent', - () => MultiFile2NativeComponentViewConfig, -); +registerGeneratedViewConfig('MultiFile2NativeComponent', MultiFile2NativeComponentViewConfig); module.exports = 'MultiFile2NativeComponent'; ", @@ -766,61 +521,29 @@ Map { 'use strict'; -const ReactNativeViewConfigRegistry = require('ReactNativeViewConfigRegistry'); -const ReactNativeViewViewConfig = require('ReactNativeViewViewConfig'); -const verifyComponentAttributeEquivalence = require('verifyComponentAttributeEquivalence'); +const registerGeneratedViewConfig = require('registerGeneratedViewConfig'); const MultiComponent1NativeComponentViewConfig = { uiViewClassName: 'MultiComponent1NativeComponent', - Commands: {}, - - bubblingEventTypes: { - ...ReactNativeViewViewConfig.bubblingEventTypes, - }, - - directEventTypes: { - ...ReactNativeViewViewConfig.directEventTypes, - }, validAttributes: { - ...ReactNativeViewViewConfig.validAttributes, disabled: true, }, }; -verifyComponentAttributeEquivalence('MultiComponent1NativeComponent', MultiComponent1NativeComponentViewConfig); - -ReactNativeViewConfigRegistry.register( - 'MultiComponent1NativeComponent', - () => MultiComponent1NativeComponentViewConfig, -); +registerGeneratedViewConfig('MultiComponent1NativeComponent', MultiComponent1NativeComponentViewConfig); module.exports = 'MultiComponent1NativeComponent'; const MultiComponent2NativeComponentViewConfig = { uiViewClassName: 'MultiComponent2NativeComponent', - Commands: {}, - - bubblingEventTypes: { - ...ReactNativeViewViewConfig.bubblingEventTypes, - }, - - directEventTypes: { - ...ReactNativeViewViewConfig.directEventTypes, - }, validAttributes: { - ...ReactNativeViewViewConfig.validAttributes, disabled: true, }, }; -verifyComponentAttributeEquivalence('MultiComponent2NativeComponent', MultiComponent2NativeComponentViewConfig); - -ReactNativeViewConfigRegistry.register( - 'MultiComponent2NativeComponent', - () => MultiComponent2NativeComponentViewConfig, -); +registerGeneratedViewConfig('MultiComponent2NativeComponent', MultiComponent2NativeComponentViewConfig); module.exports = 'MultiComponent2NativeComponent'; ",