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
This commit is contained in:
Rick Hanlon
2019-06-07 12:31:35 -07:00
committed by Facebook Github Bot
parent 12c09a2d6c
commit 886fb501bd
4 changed files with 106 additions and 377 deletions
@@ -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';