Avoid calling lazilyLoadView when running in the debugger

Summary:
@public
The Chrome debugger can't handle synchronous method calls, so we should avoid doing them.
Double wrapped the if with a DEV check so that it's removed when bundling in non-dev mode.

Reviewed By: fkgozali

Differential Revision: D10345056

fbshipit-source-id: 7a7a2c73f089693da5edafdf3ecf7a3e5d767e52
This commit is contained in:
Mehdi Mulani
2018-10-12 09:01:38 -07:00
committed by Facebook Github Bot
parent 88ccb33b7d
commit 4f757095a8

View File

@@ -57,6 +57,14 @@ UIManager.getViewManagerConfig = function(viewManagerName: string) {
return config;
}
// If we're in the Chrome Debugger, let's not even try calling the sync
// method.
if (__DEV__) {
if (!global.nativeCallSyncHook) {
return config;
}
}
if (UIManager.lazilyLoadView && !triedLoadingConfig.has(viewManagerName)) {
const result = UIManager.lazilyLoadView(viewManagerName);
triedLoadingConfig.add(viewManagerName);