Omit null process/diff functions from native VC attributes
Summary: ## Rationale - **Consistency with Static View Configs**: In Static View Configs, if there isn't a diff or process function, we do not generate a property for it. - **Type-safety**: The [Flow type for attributes](https://fburl.com/code/tafncg5c), doesn't allow null diff/process functions. Changelog: [Internal] Reviewed By: yungsters Differential Revision: D32152924 fbshipit-source-id: 4156158c5fe09868feec1a0c55aa411d2bd72a27
This commit is contained in:
Родитель
43c38cdc8e
Коммит
d03b4f9ee2
|
@ -63,8 +63,18 @@ function getNativeComponentAttributes(uiViewClassName: string): any {
|
|||
const diff = getDifferForType(typeName);
|
||||
const process = getProcessorForType(typeName);
|
||||
|
||||
// If diff or process == null, omit the corresponding property from the Attribute
|
||||
// Why:
|
||||
// 1. Consistency with AttributeType flow type
|
||||
// 2. Consistency with Static View Configs, which omit the null properties
|
||||
validAttributes[key] =
|
||||
diff == null && process == null ? true : {diff, process};
|
||||
diff == null
|
||||
? process == null
|
||||
? true
|
||||
: {process}
|
||||
: process == null
|
||||
? {diff}
|
||||
: {diff, process};
|
||||
}
|
||||
|
||||
// Unfortunately, the current setup declares style properties as top-level
|
||||
|
|
Загрузка…
Ссылка в новой задаче