Make lefthandObjectDiff private to verifyComponentAttributeEquivalence
Summary: ## Rationale verifyComponentAttributeEquivalence is the legacy check for making sure that Static ViewConfigs match Native ViewConfigs. Eventually, we should just delete this module/check from the codebase. ## Changes This diff migrates the RNHostComponentViewConfig differences screen to display the ViewConfig differences using the new StaticViewConfigValidator validation result vs the legacy validator's lefthandObjectDiff method. ## Benefits: - Now, **all the diffing logic** on this route uses the new StaticViewConfigValidator. - This takes us one step closer towards deleting verifyComponentAttributeEquivalence - StaticViewConfigValidator [supports ignoring ViewConfig properties](https://fburl.com/code/2it5r7py). Now, the RNHostComponentViewConfig respects these ignores. Changelog: [Internal] Reviewed By: p-sun Differential Revision: D34017602 fbshipit-source-id: 3ad909adcbb95b932a269dd55dd5445834a9cfd4
This commit is contained in:
Родитель
7cc7e66564
Коммит
b8a2f34dee
|
@ -15,7 +15,7 @@ import getNativeComponentAttributes from '../ReactNative/getNativeComponentAttri
|
|||
import {createViewConfig} from './ViewConfig';
|
||||
import {isIgnored} from './ViewConfigIgnore';
|
||||
|
||||
type Difference =
|
||||
export type Difference =
|
||||
| {
|
||||
type: 'missing',
|
||||
path: Array<string>,
|
||||
|
@ -33,7 +33,7 @@ type Difference =
|
|||
staticValue: mixed,
|
||||
};
|
||||
|
||||
type ValidationResult = ValidResult | InvalidResult;
|
||||
export type ValidationResult = ValidResult | InvalidResult;
|
||||
type ValidResult = {
|
||||
type: 'valid',
|
||||
};
|
||||
|
@ -42,19 +42,15 @@ type InvalidResult = {
|
|||
differences: Array<Difference>,
|
||||
};
|
||||
|
||||
type ViewConfigValidationResult = {
|
||||
// e.g. require('MyNativeComponent') where MyNativeComponent.js exports a HostComponent
|
||||
type JSModule = $FlowFixMe;
|
||||
|
||||
export function validateStaticViewConfigs(nativeComponent: JSModule): {
|
||||
componentName: string,
|
||||
nativeViewConfig?: ?ViewConfig,
|
||||
staticViewConfig?: ?ViewConfig,
|
||||
validationResult?: ?ValidationResult,
|
||||
};
|
||||
|
||||
// e.g. require('MyNativeComponent') where MyNativeComponent.js exports a HostComponent
|
||||
type JSModule = $FlowFixMe;
|
||||
|
||||
export function validateStaticViewConfigs(
|
||||
nativeComponent: JSModule,
|
||||
): ViewConfigValidationResult {
|
||||
} {
|
||||
const nativeViewConfig = getNativeComponentAttributes(
|
||||
nativeComponent.default || nativeComponent,
|
||||
);
|
||||
|
|
|
@ -62,7 +62,7 @@ export default function verifyComponentAttributeEquivalence(
|
|||
|
||||
// Return the different key-value pairs of the right object, by iterating through the keys in the left object
|
||||
// Note it won't return a difference where a key is missing in the left but exists the right.
|
||||
export function lefthandObjectDiff(leftObj: Object, rightObj: Object): Object {
|
||||
function lefthandObjectDiff(leftObj: Object, rightObj: Object): Object {
|
||||
const differentKeys = {};
|
||||
|
||||
function compare(leftItem: any, rightItem: any, key: string) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче