RN: Cleanup ViewConfig Types

Summary:
Cleans up the Flow types for React Native ViewConfig. After this diff, we will have two new canonical types:

- `ViewConfig` which is what we get from native and what is registered in the `ReactNativeViewConfigRegistry`.
- `PartialViewConfig` which is what we generate statically and augment at runtime before registering with the `ReactNativeViewConfigRegistry`.

Changelog:
[Internal]

Reviewed By: JoshuaGross

Differential Revision: D25075299

fbshipit-source-id: 4b53927b2db437b615447b711e83db355d0cfa55
This commit is contained in:
Tim Yung authored and Facebook GitHub Bot committed 2020-11-18 21:19:12 -08:00
1 parent 69b4611049
commit e136aa3fc4
11 files changed
+47 -82

No files matched your search

@@ -10,43 +10,15 @@
'use strict';
import {type PartialViewConfig} from '../Renderer/shims/ReactNativeTypes';
import ReactNativeViewConfigRegistry from '../Renderer/shims/ReactNativeViewConfigRegistry';
import ReactNativeViewViewConfig from '../Components/View/ReactNativeViewViewConfig';
import getNativeComponentAttributes from '../ReactNative/getNativeComponentAttributes';
import verifyComponentAttributeEquivalence from './verifyComponentAttributeEquivalence';
export 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,
viewConfig: PartialViewConfig,
) {
const staticViewConfig = {
uiViewClassName: componentName,