From 49b3b31d8e706338dac4ced1b372424d7d1d133f Mon Sep 17 00:00:00 2001 From: Andrew Coates <30809111+acoates-ms@users.noreply.github.com> Date: Mon, 30 Aug 2021 18:02:02 -0700 Subject: [PATCH] Native component check in deprecatedPropType was inverted (#31164) Summary: While investigating an issue hit on a recent sync of [react-native-windows](https://github.com/microsoft/react-native-windows) I noticed that https://github.com/facebook/react-native/commit/e68cf7cee9d36271a1d3899fecff817304bb8bdc appears to have accidently inverted the logic to avoid checking native components. `!UIManager.getViewManagerConfig(componentName)` become `UIManager.hasViewManagerConfig(componentName)` losing the ! Also adding a check in PaperUIManager's getViewManagerConfig to avoid trying to call a sync method when using Chrome Debugging. ## Changelog [Internal] [Fixed] - Restored the previous logic of deprecatedPropType Pull Request resolved: https://github.com/facebook/react-native/pull/31164 Test Plan: Change tested and being submitted in react-native-windows: https://github.com/microsoft/react-native-windows/pull/7397 Reviewed By: hramos Differential Revision: D30624302 Pulled By: fkgozali fbshipit-source-id: 0f26e750283a1fa5eb5f44ecd2cf90617b6d931f --- Libraries/ReactNative/PaperUIManager.js | 1 + Libraries/Utilities/deprecatedPropType.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Libraries/ReactNative/PaperUIManager.js b/Libraries/ReactNative/PaperUIManager.js index c468958e56..87cc101db3 100644 --- a/Libraries/ReactNative/PaperUIManager.js +++ b/Libraries/ReactNative/PaperUIManager.js @@ -34,6 +34,7 @@ function getConstants(): Object { function getViewManagerConfig(viewManagerName: string): any { if ( viewManagerConfigs[viewManagerName] === undefined && + global.nativeCallSyncHook && // If we're in the Chrome Debugger, let's not even try calling the sync method NativeUIManager.getConstantsForViewManager ) { try { diff --git a/Libraries/Utilities/deprecatedPropType.js b/Libraries/Utilities/deprecatedPropType.js index 1801f98cb1..0a0fc69aab 100644 --- a/Libraries/Utilities/deprecatedPropType.js +++ b/Libraries/Utilities/deprecatedPropType.js @@ -21,7 +21,7 @@ function deprecatedPropType( // Don't warn for native components. if ( global.RN$Bridgeless !== true && - UIManager.hasViewManagerConfig(componentName) && + !UIManager.hasViewManagerConfig(componentName) && props[propName] !== undefined ) { console.warn(