Files
react-native/Libraries/Utilities/registerGeneratedViewConfig.js
T
Jordan Brown 93e58b2c96 Suppressions for 0.111
Summary:
still some generated files in www that need to land before we can release 0.111 here.

drop-conflicts

Changelog: [Internal]

(Note: this ignores all push blocking failures!)

Reviewed By: dsainati1

Differential Revision: D18278838

fbshipit-source-id: b20c3fefb3aab7c5fb614b33d846c7548184f49a
2019-11-05 17:36:23 -08:00

80 lines
2.4 KiB
JavaScript

/**
* 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');
import verifyComponentAttributeEquivalence from './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?: <T>(arg1: any, arg2: any) => boolean,
process?: (arg1: any) => any,
|}>,
},
};
function registerGeneratedViewConfig(
componentName: string,
viewConfig: GeneratedViewConfig,
) {
const mergedViewConfig = {
uiViewClassName: componentName,
Commands: {},
bubblingEventTypes: {
...ReactNativeViewViewConfig.bubblingEventTypes,
/* $FlowFixMe(>=0.111.0 site=react_native_fb) This comment suppresses an
* error found when Flow v0.111 was deployed. To see the error, delete
* this comment and run Flow. */
...(viewConfig.bubblingEventTypes || {}),
},
directEventTypes: {
...ReactNativeViewViewConfig.directEventTypes,
/* $FlowFixMe(>=0.111.0 site=react_native_fb) This comment suppresses an
* error found when Flow v0.111 was deployed. To see the error, delete
* this comment and run Flow. */
...(viewConfig.directEventTypes || {}),
},
validAttributes: {
...ReactNativeViewViewConfig.validAttributes,
/* $FlowFixMe(>=0.111.0 site=react_native_fb) This comment suppresses an
* error found when Flow v0.111 was deployed. To see the error, delete
* this comment and run Flow. */
...(viewConfig.validAttributes || {}),
},
};
ReactNativeViewConfigRegistry.register(componentName, () => {
verifyComponentAttributeEquivalence(componentName, mergedViewConfig);
return mergedViewConfig;
});
}
module.exports = registerGeneratedViewConfig;