Files
react-native/Libraries/NativeComponent/PlatformBaseViewConfig.js
T
Paige Sun 033ad83b29 Refactor the JS base StaticViewConfig to be easier to understand
Summary:
Changelog: [Internal][SVC][JS] Refactor the JS base SVC StaticViewConfig to be easier to understand

This diff is a refactor that doesn't change any logic.

# Context
NativeViewConfigs are generated from RCTViewManager in iOS and ViewManager in Android.
StaticViewConfigs are partially generated from JS, and partially handwritten in JS.

We've noticed in at least 2 instances that engineers who add new props to NativeViewConfigs sometimes don't put props in the correct place for StaticViewConfigs, and thus they accidentally break the landblocking jest e2e test that validates the StaticViewConfigs matches the NativeViewConfigs.

The human error is mostly because PlatformBaseViewConfig.js was too nested to be easily understood. This diff refactors PlatformBaseViewConfig.js and adds clarifying comments.

Reviewed By: RSNara

Differential Revision: D35623775

fbshipit-source-id: 498a3daa812fa314821a2e7cb7d6f809900dbe3a
2022-04-14 10:34:55 -07:00

25 lines
771 B
JavaScript

/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
* @flow strict-local
*/
import type {PartialViewConfig} from '../Renderer/shims/ReactNativeTypes';
import BaseViewConfig from './BaseViewConfig';
export type PartialViewConfigWithoutName = $Rest<
PartialViewConfig,
{uiViewClassName: string},
>;
const PlatformBaseViewConfig: PartialViewConfigWithoutName = BaseViewConfig;
// In Wilde/FB4A, use RNHostComponentListRoute in Bridge mode to verify
// whether the JS props defined here match the native props defined
// in RCTViewManagers in iOS, and ViewManagers in Android.
export default PlatformBaseViewConfig;