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-08-22 12:49:15 -07:00 committed by Facebook Github Bot
parent d0eb8ff858
commit 158e9c4dde
1 changed files with 35 additions and 6 deletions

View File

@ -44,13 +44,42 @@ type DirectEventType = {
registrationName: string, registrationName: string,
}; };
export type ReactNativeBaseComponentViewConfig = { type AttributeType =
validAttributes: Object, | 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, uiViewClassName: string,
bubblingEventTypes?: {[topLevelType: string]: BubblingEventType}, validAttributes: $ReadOnly<{
directEventTypes?: {[topLevelType: string]: DirectEventType}, [propName: string]: AttributeType,
propTypes?: Object, style: $ReadOnly<{
}; [propName: string]: AttributeType,
}>,
}>,
|}>;
export type ViewConfigGetter = () => ReactNativeBaseComponentViewConfig; export type ViewConfigGetter = () => ReactNativeBaseComponentViewConfig;