Skip to content

Commit

Permalink
Native component check in deprecatedPropType was inverted (#31164)
Browse files Browse the repository at this point in the history
Summary:
While investigating an issue hit on a recent sync of [react-native-windows](https://github.com/microsoft/react-native-windows) I noticed that e68cf7c 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.

[Internal] [Fixed] - Restored the previous logic of deprecatedPropType

Pull Request resolved: #31164

Test Plan:
Change tested and being submitted in react-native-windows:
microsoft/react-native-windows#7397

Reviewed By: hramos

Differential Revision: D30624302

Pulled By: fkgozali

fbshipit-source-id: 0f26e750283a1fa5eb5f44ecd2cf90617b6d931f
  • Loading branch information
acoates-ms authored and Luna Wei committed Sep 1, 2021
1 parent a0429eb commit d20b34a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions Libraries/ReactNative/PaperUIManager.js
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions Libraries/Utilities/deprecatedPropType.js
Expand Up @@ -20,8 +20,8 @@ function deprecatedPropType(
return function validate(props, propName, componentName, ...rest) {
// Don't warn for native components.
if (
!global.RN$Bridgeless &&
UIManager.hasViewManagerConfig(componentName) &&
global.RN$Bridgeless !== true &&
!UIManager.hasViewManagerConfig(componentName) &&
props[propName] !== undefined
) {
console.warn(
Expand Down

0 comments on commit d20b34a

Please sign in to comment.