Disable static ViewConfigs in bridge mode & enable for bridgeless mode - for codegenNativeComponent

Summary:
Changelog: [Internal]

Since DummyUIManager.getViewManagerConfig() & hasViewManagerConfig() are the same, it's safe to ship this before the native changes in this stack lands.

Reviewed By: RSNara

Differential Revision: D33832926

fbshipit-source-id: c0f0a169d02397e0f9125bb45d95d395c8bbc492
This commit is contained in:
Paige Sun 2022-01-28 23:38:05 -08:00 коммит произвёл Facebook GitHub Bot
Родитель 79ae50f3e9
Коммит ab843c5736
2 изменённых файлов: 4 добавлений и 7 удалений

Просмотреть файл

@ -130,9 +130,8 @@ export default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL
`.trim();
};
// If static view configs are enabled, get whether the native component exists
// in the app binary using hasViewManagerConfig() instead of getViewManagerConfig().
// Old getViewManagerConfig() checks for the existance of the native Paper view manager.
// Check whether the native component exists in the app binary.
// Old getViewManagerConfig() checks for the existance of the native Paper view manager. Not available in Bridgeless.
// New hasViewManagerConfig() queries Fabrics native component registry directly.
const DeprecatedComponentNameCheckTemplate = ({
componentName,
@ -142,8 +141,7 @@ const DeprecatedComponentNameCheckTemplate = ({
paperComponentNameDeprecated: string,
}) =>
`
const staticViewConfigsEnabled = global.__fbStaticViewConfig === true;
if (staticViewConfigsEnabled) {
if (global.__nativeComponentRegistry__hasComponent) {
if (UIManager.hasViewManagerConfig('${componentName}')) {
nativeComponentName = '${componentName}';
} else if (UIManager.hasViewManagerConfig('${paperComponentNameDeprecated}')) {

Просмотреть файл

@ -1046,8 +1046,7 @@ const NativeComponentRegistry = require('react-native/Libraries/NativeComponent/
const {UIManager} = require(\\"react-native\\")
let nativeComponentName = 'NativeComponentName';
const staticViewConfigsEnabled = global.__fbStaticViewConfig === true;
if (staticViewConfigsEnabled) {
if (global.__nativeComponentRegistry__hasComponent) {
if (UIManager.hasViewManagerConfig('NativeComponentName')) {
nativeComponentName = 'NativeComponentName';
} else if (UIManager.hasViewManagerConfig('DeprecatedNativeComponentName')) {