Adding a more complete type for ReactNativeBaseComponentViewConfig

Summary:
As we add js view configs to our view managers, we want this type to be a little bit more strict.

This will be especially useful as we start removing certain keys (like NativeProps) which aren't actually necessary, this will make sure we remove them everywhere.

Reviewed By: yungsters

Differential Revision: D9416905

fbshipit-source-id: 6b12e38b9d56969a81ec5d4f2920298e4919f7be
This commit is contained in:
Eli White
2018-09-11 15:25:03 -07:00
committed by Hector Ramos
parent 3c1ffd81c7
commit cbad15863d
+35 -6
View File
@@ -44,13 +44,42 @@ type DirectEventType = {
registrationName: string,
};
export type ReactNativeBaseComponentViewConfig = {
validAttributes: Object,
type AttributeType =
| true
| $ReadOnly<{|
diff: ?<T>(arg1: T, arg2: T) => boolean,
process: ?(arg1: any) => any,
|}>;
export type ReactNativeBaseComponentViewConfig = $ReadOnly<{|
baseModuleName?: string,
bubblingEventTypes?: $ReadOnly<{
[eventName: string]: $ReadOnly<{|
phasedRegistrationNames: $ReadOnly<{|
captured: string,
bubbled: string,
|}>,
|}>,
}>,
Commands?: $ReadOnly<{
[commandName: string]: number,
}>,
directEventTypes?: $ReadOnly<{
[eventName: string]: $ReadOnly<{|
registrationName: string,
|}>,
}>,
NativeProps?: $ReadOnly<{
[propName: string]: string,
}>,
uiViewClassName: string,
bubblingEventTypes?: {[topLevelType: string]: BubblingEventType},
directEventTypes?: {[topLevelType: string]: DirectEventType},
propTypes?: Object,
};
validAttributes: $ReadOnly<{
[propName: string]: AttributeType,
style: $ReadOnly<{
[propName: string]: AttributeType,
}>,
}>,
|}>;
export type ViewConfigGetter = () => ReactNativeBaseComponentViewConfig;