Skip to content

Commit

Permalink
Correctly bypass sync calls in UIManager during remote debugging (#25162
Browse files Browse the repository at this point in the history
)

Summary:
Remote debugging stopped working (since 0.58, according to #23254). See #23254 (comment) for repro steps.

The root cause is incorrect checks for Chrome debugging environment in `UIManager.js`.
- In one place where sync function `lazilyLoadView` should be avoided, we effectively use `if (__DEV__ && !global.nativeCallSyncHook)` to check remote debugging, which misses ship flavor (i.e. `__DEV__` is false).
- In another place where we want to pre-populate view managers' constants to avoid calling sync function `getConstantsForViewManager`, `if (__DEV__)` is used, also missing ship flavor.

This PR fixes both checks, only using the absense of `global.nativeCallSyncHook` to determine remote debugging environments.

## Changelog

[JavaScript] [Fixed] - Correctly bypass sync calls in UIManager during remote debugging
Pull Request resolved: #25162

Differential Revision: D15692492

Pulled By: cpojer

fbshipit-source-id: 173b688f140916b767fcdbbaaf68a5c303adbcd1
  • Loading branch information
statm authored and facebook-github-bot committed Jun 6, 2019
1 parent 831f5fe commit 417e191
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions Libraries/ReactNative/UIManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,8 @@ const UIManagerJS: UIManagerJSInterface = {

// If we're in the Chrome Debugger, let's not even try calling the sync
// method.
if (__DEV__) {
if (!global.nativeCallSyncHook) {
return config;
}
if (!global.nativeCallSyncHook) {
return config;
}

if (
Expand Down Expand Up @@ -182,7 +180,7 @@ if (Platform.OS === 'ios') {
}
}

if (__DEV__) {
if (!global.nativeCallSyncHook) {
Object.keys(getConstants()).forEach(viewManagerName => {
if (!UIManagerProperties.includes(viewManagerName)) {
if (!viewManagerConfigs[viewManagerName]) {
Expand Down

0 comments on commit 417e191

Please sign in to comment.