Skip to content

Commit 95f950d

Browse files
RSNarafacebook-github-bot
authored andcommitted
Move validateStaticViewConfigs to RNHostComponentList route
Summary: This function is only used by the RNHostComponentList route. Let's move it into the route, so that we could keep the StaticViewConfigValidator slim. This will also allow us to more heavily customize this function for the route. Changelog: [Internal] Reviewed By: p-sun Differential Revision: D34026073 fbshipit-source-id: c3b3a93aed6007fadda2993afa52c28c028f6327
1 parent bb435a2 commit 95f950d

1 file changed

Lines changed: 0 additions & 35 deletions

File tree

Libraries/NativeComponent/StaticViewConfigValidator.js

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@
99
*/
1010

1111
import {type ViewConfig} from '../Renderer/shims/ReactNativeTypes';
12-
// $FlowFixMe[nonstrict-import]
13-
import getNativeComponentAttributes from '../ReactNative/getNativeComponentAttributes';
14-
// $FlowFixMe[nonstrict-import]
15-
import {createViewConfig} from './ViewConfig';
1612
import {isIgnored} from './ViewConfigIgnore';
1713

1814
export type Difference =
@@ -42,37 +38,6 @@ type InvalidResult = {
4238
differences: Array<Difference>,
4339
};
4440

45-
// e.g. require('MyNativeComponent') where MyNativeComponent.js exports a HostComponent
46-
type JSModule = $FlowFixMe;
47-
48-
export function validateStaticViewConfigs(nativeComponent: JSModule): {
49-
componentName: string,
50-
nativeViewConfig?: ?ViewConfig,
51-
staticViewConfig?: ?ViewConfig,
52-
validationResult?: ?ValidationResult,
53-
} {
54-
const nativeViewConfig = getNativeComponentAttributes(
55-
nativeComponent.default || nativeComponent,
56-
);
57-
58-
const generatedPartialViewConfig = nativeComponent.__INTERNAL_VIEW_CONFIG;
59-
const staticViewConfig: ?ViewConfig =
60-
generatedPartialViewConfig && createViewConfig(generatedPartialViewConfig);
61-
62-
const componentName: string = nativeComponent.default || nativeComponent;
63-
const validationResult: ?ValidationResult =
64-
nativeViewConfig &&
65-
staticViewConfig &&
66-
validate(componentName, nativeViewConfig, staticViewConfig);
67-
68-
return {
69-
componentName,
70-
nativeViewConfig,
71-
staticViewConfig,
72-
validationResult,
73-
};
74-
}
75-
7641
/**
7742
* During the migration from native view configs to static view configs, this is
7843
* used to validate that the two are equivalent.

0 commit comments

Comments
 (0)