diff --git a/change/@uifabricshared-theming-react-native-2020-08-12-17-25-28-colorsFix.json b/change/@uifabricshared-theming-react-native-2020-08-12-17-25-28-colorsFix.json new file mode 100644 index 0000000000..3f3669b0fd --- /dev/null +++ b/change/@uifabricshared-theming-react-native-2020-08-12-17-25-28-colorsFix.json @@ -0,0 +1,8 @@ +{ + "type": "patch", + "comment": "Set \"WhiteColors\" as palette id if no id is provided", + "packageName": "@uifabricshared/theming-react-native", + "email": "krsiler@microsoft.com", + "dependentChangeType": "patch", + "date": "2020-08-13T00:25:28.785Z" +} diff --git a/packages/framework/theming-react-native/src/NativeModule/ThemingModuleHelpers.ts b/packages/framework/theming-react-native/src/NativeModule/ThemingModuleHelpers.ts index 37f8a6a578..569539075d 100644 --- a/packages/framework/theming-react-native/src/NativeModule/ThemingModuleHelpers.ts +++ b/packages/framework/theming-react-native/src/NativeModule/ThemingModuleHelpers.ts @@ -32,8 +32,12 @@ function updatePaletteInCache(module: IOfficeThemingModule, cache: PaletteCache, } } +const getPaletteCacheKey = (palette?: string) => { + return useFakePalette ? 'debug' : palette || 'WhiteColors'; +}; + function translatePalette(module: IOfficeThemingModule, paletteCache: PaletteCache, palette?: string): IPartialPalette { - const key = useFakePalette ? 'debug' : palette || 'WhiteColors'; + const key = getPaletteCacheKey(palette); if (!paletteCache[key]) { updatePaletteInCache(module, paletteCache, key); } @@ -52,7 +56,7 @@ export function translateOfficeTheme(module: IOfficeThemingModule, cache: Palett }, typography: module.fluentTypography, host: { - palette: cache[id] + palette: cache[getPaletteCacheKey(id)] } }; }