Handle empty string returned from NativeAppearance.getColorScheme()

Reviewed By: PeteTheHeat

Differential Revision: D17151675

fbshipit-source-id: 39b9a32271cd45b82faa5e0248d589ef1ed9f4c9
This commit is contained in:
Ram N
2019-09-03 12:11:15 -07:00
committed by Facebook Github Bot
parent adac04601e
commit 49f59a6b9e
+2 -1
View File
@@ -21,8 +21,9 @@ import invariant from 'invariant';
type AppearanceListener = (preferences: AppearancePreferences) => void;
const eventEmitter = new EventEmitter();
// TODO: (hramos) T52919652 Use ?ColorSchemeName once codegen supports union
const nativeColorScheme: ?string =
NativeAppearance == null ? null : NativeAppearance.getColorScheme();
NativeAppearance == null ? null : NativeAppearance.getColorScheme() || null;
invariant(
nativeColorScheme === 'dark' ||
nativeColorScheme === 'light' ||