@fluentui-react-native/apple-theme 0.16.1 → 0.16.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -212,8 +212,8 @@ function getFluentUIAppleDarkPalette(): ApplePalette {
212
212
  }
213
213
 
214
214
  /** Creates a palette of colors for the apple theme, using the appropriate FluentUI Apple Palette based on appearance */
215
- export function paletteFromAppleColors(isDark: boolean): ThemeColorDefinition {
216
- const fluentApple = isDark ? getFluentUIAppleDarkPalette() : getFluentUIAppleLightPalette();
215
+ export function paletteFromAppleColors(isLightMode: boolean): ThemeColorDefinition {
216
+ const fluentApple = isLightMode ? getFluentUIAppleLightPalette() : getFluentUIAppleDarkPalette();
217
217
 
218
218
  return {
219
219
  /* PaletteBackgroundColors & PaletteTextColors */
@@ -131,20 +131,13 @@ const appleComponents = {
131
131
  },
132
132
  };
133
133
 
134
- export const BaseAppleLightThemeIOS: Theme = {
135
- colors: paletteFromAppleColors(false),
136
- typography: appleTypography(),
137
- shadows: iOSShadows(),
138
- spacing: appleSpacing(),
139
- components: appleComponents,
140
- host: { appearance: 'light' },
141
- };
142
-
143
- export const BaseAppleDarkThemeIOS: Theme = {
144
- colors: paletteFromAppleColors(true),
145
- typography: appleTypography(),
146
- shadows: iOSShadows(),
147
- spacing: appleSpacing(),
148
- components: appleComponents,
149
- host: { appearance: 'dark' },
150
- };
134
+ export function getBaseAppleThemeIOS(isLightMode: boolean): Theme {
135
+ return {
136
+ colors: paletteFromAppleColors(isLightMode),
137
+ typography: appleTypography(),
138
+ shadows: iOSShadows(),
139
+ spacing: appleSpacing(),
140
+ components: appleComponents,
141
+ host: { appearance: isLightMode ? 'light' : 'dark' },
142
+ };
143
+ }
@@ -1,15 +1,13 @@
1
1
  import { ThemeReference } from '@fluentui-react-native/theme';
2
2
  import { Theme } from '@fluentui-react-native/theme-types';
3
3
  import { Appearance } from 'react-native';
4
- import { BaseAppleDarkThemeIOS, BaseAppleLightThemeIOS } from './appleTheme.ios';
4
+ import { getBaseAppleThemeIOS } from './appleTheme.ios';
5
5
 
6
6
  export function createAppleTheme(): ThemeReference {
7
- const baseAppleTheme = () => {
8
- const current = Appearance.getColorScheme();
9
- return current === 'light' ? BaseAppleLightThemeIOS : BaseAppleDarkThemeIOS;
10
- };
11
-
12
- const appleThemeReference = new ThemeReference({} as Theme, baseAppleTheme);
7
+ const appleThemeReference = new ThemeReference({} as Theme, () => {
8
+ const isLightMode = Appearance.getColorScheme() === 'light';
9
+ return getBaseAppleThemeIOS(isLightMode);
10
+ });
13
11
 
14
12
  Appearance.addChangeListener(() => {
15
13
  appleThemeReference.invalidate();