Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/core/__tests__/theming.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions src/theme/provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,14 @@ export function adaptNavigationTheme<T extends NavigationTheme>(themes: {
reactNavigationLight: T;
materialLight?: Theme;
}): {
LightTheme: NavigationTheme;
LightTheme: T;
};
// eslint-disable-next-line no-redeclare
export function adaptNavigationTheme<T extends NavigationTheme>(themes: {
reactNavigationDark: T;
materialDark?: Theme;
}): {
DarkTheme: NavigationTheme;
DarkTheme: T;
};
// eslint-disable-next-line no-redeclare
export function adaptNavigationTheme<
Expand Down
Loading