Skip to content

Commit f7b9033

Browse files
elicwhitefacebook-github-bot
authored andcommitted
Fix Appearance module when using Chrome Debugger
Summary: The appearance module uses sync native module methods which doesn't work with the chrome debugger. This broke in 0.62: #26705 This fix makes the appearance module return 'light' when using the chrome debugger. Changelog: [Fixed] Appearance `getColorScheme` no longer breaks the debugger Reviewed By: yungsters Differential Revision: D20879779 fbshipit-source-id: ad49c66226096433bc9f270e004ad4a6f54fa8c2
1 parent 990dd86 commit f7b9033

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Libraries/Utilities/Appearance.js

+9
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import NativeAppearance, {
1717
type ColorSchemeName,
1818
} from './NativeAppearance';
1919
import invariant from 'invariant';
20+
import {isAsyncDebugging} from './DebugEnvironment';
2021

2122
type AppearanceListener = (preferences: AppearancePreferences) => void;
2223
const eventEmitter = new EventEmitter();
@@ -50,6 +51,14 @@ module.exports = {
5051
* @returns {?ColorSchemeName} Value for the color scheme preference.
5152
*/
5253
getColorScheme(): ?ColorSchemeName {
54+
if (__DEV__) {
55+
if (isAsyncDebugging) {
56+
// Hard code light theme when using the async debugger as
57+
// sync calls aren't supported
58+
return 'light';
59+
}
60+
}
61+
5362
// TODO: (hramos) T52919652 Use ?ColorSchemeName once codegen supports union
5463
const nativeColorScheme: ?string =
5564
NativeAppearance == null

0 commit comments

Comments
 (0)