-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fonts property on DefaulTheme @react-navigation/native version ^7 #4540
Labels
Comments
One workaround is spreading the navigation theme fonts. Something like this
|
My workaround: import { useThemeContext } from '@/components/ThemeProvider';
import {
DarkTheme as NavigationDarkTheme,
DefaultTheme as NavigationDefaultTheme,
ThemeProvider as NavigationThemeProvider,
} from '@react-navigation/native';
import {
adaptNavigationTheme,
MD3DarkTheme,
MD3LightTheme,
Provider,
ProviderProps,
} from 'react-native-paper';
export function PaperProvider({ children, ...otherProps }: ProviderProps) {
const { isThemeDark, theme } = useThemeContext();
const { LightTheme, DarkTheme } = adaptNavigationTheme({
reactNavigationLight: NavigationDefaultTheme,
reactNavigationDark: NavigationDarkTheme,
materialDark: MD3DarkTheme,
materialLight: MD3LightTheme,
});
const paperTheme = isThemeDark
? {
...MD3DarkTheme,
...DarkTheme,
colors: {
...MD3DarkTheme.colors,
...DarkTheme.colors,
...theme.dark,
},
fonts: {
...MD3DarkTheme.fonts,
...NavigationDarkTheme.fonts,
...theme.dark,
},
}
: {
...MD3LightTheme,
...LightTheme,
colors: {
...MD3LightTheme.colors,
...LightTheme.colors,
...theme.light,
},
fonts: {
...MD3LightTheme.fonts,
...NavigationDefaultTheme.fonts,
...theme.light,
},
};
return (
<Provider theme={paperTheme} {...otherProps}>
<NavigationThemeProvider value={paperTheme}>
{children}
</NavigationThemeProvider>
</Provider>
);
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Current behaviour
This adaptation doesnt work
its because actually the New Interface DefaultTheme/LightTheme from react-navigation/native use a propertie font that NavigationTheme from react native papers doesnt have
Interface DefaultTheme from react-navigation/native
type NavigationTheme from react-native-paper/lib/typescript/types
Expected behaviour
How to reproduce?
Preview
What have you tried so far?
Your Environment
The text was updated successfully, but these errors were encountered: