diff --git a/src/core/__tests__/theming.test.tsx b/src/core/__tests__/theming.test.tsx index cb61aef20d..3ae5d44691 100644 --- a/src/core/__tests__/theming.test.tsx +++ b/src/core/__tests__/theming.test.tsx @@ -264,6 +264,26 @@ describe('adaptNavigationTheme', () => { }); }); + it('should keep fonts and custom colors when adapting a single theme', () => { + const { LightTheme: navLight } = adaptNavigationTheme({ + reactNavigationLight: { + ...NavigationThemeWithFonts, + colors: NavigationCustomLightTheme.colors, + }, + }); + const { DarkTheme: navDark } = adaptNavigationTheme({ + reactNavigationDark: { ...NavigationThemeWithFonts, dark: true }, + }); + + expect(navLight.colors.secondary).toBe('rgb(150,45,85)'); + expect(navLight.fonts.regular.fontFamily).toBe( + LightTheme.fonts.bodyMedium.fontFamily + ); + expect(navDark.fonts.regular.fontFamily).toBe( + DarkTheme.fonts.bodyMedium.fontFamily + ); + }); + it('should not expect fonts on theme without fonts', () => { const { LightTheme: navLight, DarkTheme: navDark } = adaptNavigationTheme({ reactNavigationLight: NavigationLightTheme, diff --git a/src/theme/provider.tsx b/src/theme/provider.tsx index 8f7e77681e..2c1f8ca9f9 100644 --- a/src/theme/provider.tsx +++ b/src/theme/provider.tsx @@ -75,14 +75,14 @@ export function adaptNavigationTheme(themes: { reactNavigationLight: T; materialLight?: Theme; }): { - LightTheme: NavigationTheme; + LightTheme: T; }; // eslint-disable-next-line no-redeclare export function adaptNavigationTheme(themes: { reactNavigationDark: T; materialDark?: Theme; }): { - DarkTheme: NavigationTheme; + DarkTheme: T; }; // eslint-disable-next-line no-redeclare export function adaptNavigationTheme<