mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-24 04:16:00 +08:00
Require all Android View Attributes are defined in flow prop types
Summary: This caught a few flow types that weren't defined for attributes that Android exposes. Ensuring that these stay in sync will be necessary for codegen in the future. Reviewed By: sahrens Differential Revision: D9444165 fbshipit-source-id: 8ee00af7b732c35d7f6befcdf79f77b73eac6a1b
This commit is contained in:
committed by
Facebook Github Bot
parent
158e9c4dde
commit
f5be89b8b9
@@ -51,7 +51,10 @@ type AttributeType =
|
||||
process: ?(arg1: any) => any,
|
||||
|}>;
|
||||
|
||||
export type ReactNativeBaseComponentViewConfig = $ReadOnly<{|
|
||||
export type ReactNativeBaseComponentViewConfig<
|
||||
TProps = string,
|
||||
TStyleProps = string,
|
||||
> = $ReadOnly<{|
|
||||
baseModuleName?: string,
|
||||
bubblingEventTypes?: $ReadOnly<{
|
||||
[eventName: string]: $ReadOnly<{|
|
||||
@@ -74,14 +77,14 @@ export type ReactNativeBaseComponentViewConfig = $ReadOnly<{|
|
||||
}>,
|
||||
uiViewClassName: string,
|
||||
validAttributes: $ReadOnly<{
|
||||
[propName: string]: AttributeType,
|
||||
[propName: TProps]: AttributeType,
|
||||
style: $ReadOnly<{
|
||||
[propName: string]: AttributeType,
|
||||
[propName: TStyleProps]: AttributeType,
|
||||
}>,
|
||||
}>,
|
||||
|}>;
|
||||
|
||||
export type ViewConfigGetter = () => ReactNativeBaseComponentViewConfig;
|
||||
export type ViewConfigGetter = () => ReactNativeBaseComponentViewConfig<>;
|
||||
|
||||
/**
|
||||
* Class only exists for its Flow type.
|
||||
|
||||
@@ -30,7 +30,7 @@ const viewConfigCallbacks = new Map();
|
||||
const viewConfigs = new Map();
|
||||
|
||||
function processEventTypes(
|
||||
viewConfig: ReactNativeBaseComponentViewConfig,
|
||||
viewConfig: ReactNativeBaseComponentViewConfig<>,
|
||||
): void {
|
||||
const {bubblingEventTypes, directEventTypes} = viewConfig;
|
||||
|
||||
@@ -86,7 +86,7 @@ exports.register = function(name: string, callback: ViewConfigGetter): string {
|
||||
* If this is the first time the view has been used,
|
||||
* This configuration will be lazy-loaded from UIManager.
|
||||
*/
|
||||
exports.get = function(name: string): ReactNativeBaseComponentViewConfig {
|
||||
exports.get = function(name: string): ReactNativeBaseComponentViewConfig<> {
|
||||
let viewConfig;
|
||||
if (!viewConfigs.has(name)) {
|
||||
const callback = viewConfigCallbacks.get(name);
|
||||
|
||||
Reference in New Issue
Block a user