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.

## Changelog

[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 facebook-github-bot committed Aug 31, 2021
1 parent de1a72a commit 49b3b31
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions Libraries/ReactNative/PaperUIManager.js
Original file line number Diff line number Diff line change
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
2 changes: 1 addition & 1 deletion Libraries/Utilities/deprecatedPropType.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 49b3b31

Please sign in to comment.