Fix lineHeight error by adding proper font configuration to theme
This commit is contained in:
@ -1,5 +1,28 @@
|
||||
import { MD3DarkTheme, MD3LightTheme, adaptNavigationTheme } from 'react-native-paper';
|
||||
import { MD3DarkTheme, MD3LightTheme, adaptNavigationTheme, configureFonts } from 'react-native-paper';
|
||||
import { DefaultTheme, DarkTheme } from '@react-navigation/native';
|
||||
import { Platform } from 'react-native';
|
||||
|
||||
// Базовые настройки шрифтов
|
||||
const baseFont = Platform.select({
|
||||
ios: {
|
||||
fontFamily: 'System',
|
||||
letterSpacing: 0,
|
||||
},
|
||||
android: {
|
||||
fontFamily: 'Roboto',
|
||||
letterSpacing: 0,
|
||||
},
|
||||
default: {
|
||||
fontFamily: 'System',
|
||||
letterSpacing: 0,
|
||||
},
|
||||
});
|
||||
|
||||
const baseVariants = configureFonts({
|
||||
config: {
|
||||
...baseFont,
|
||||
},
|
||||
});
|
||||
|
||||
// Цвета для темной темы
|
||||
const darkColors = {
|
||||
@ -67,6 +90,107 @@ export const darkTheme = {
|
||||
...NavigationDarkTheme.colors,
|
||||
...darkColors,
|
||||
},
|
||||
fonts: configureFonts({
|
||||
config: {
|
||||
...baseFont,
|
||||
displayLarge: {
|
||||
...baseFont,
|
||||
fontSize: 57,
|
||||
lineHeight: 64,
|
||||
letterSpacing: 0,
|
||||
},
|
||||
displayMedium: {
|
||||
...baseFont,
|
||||
fontSize: 45,
|
||||
lineHeight: 52,
|
||||
letterSpacing: 0,
|
||||
},
|
||||
displaySmall: {
|
||||
...baseFont,
|
||||
fontSize: 36,
|
||||
lineHeight: 44,
|
||||
letterSpacing: 0,
|
||||
},
|
||||
headlineLarge: {
|
||||
...baseFont,
|
||||
fontSize: 32,
|
||||
lineHeight: 40,
|
||||
letterSpacing: 0,
|
||||
},
|
||||
headlineMedium: {
|
||||
...baseFont,
|
||||
fontSize: 28,
|
||||
lineHeight: 36,
|
||||
letterSpacing: 0,
|
||||
},
|
||||
headlineSmall: {
|
||||
...baseFont,
|
||||
fontSize: 24,
|
||||
lineHeight: 32,
|
||||
letterSpacing: 0,
|
||||
},
|
||||
titleLarge: {
|
||||
...baseFont,
|
||||
fontSize: 22,
|
||||
lineHeight: 28,
|
||||
letterSpacing: 0,
|
||||
},
|
||||
titleMedium: {
|
||||
...baseFont,
|
||||
fontSize: 16,
|
||||
lineHeight: 24,
|
||||
letterSpacing: 0.15,
|
||||
},
|
||||
titleSmall: {
|
||||
...baseFont,
|
||||
fontSize: 14,
|
||||
lineHeight: 20,
|
||||
letterSpacing: 0.1,
|
||||
},
|
||||
bodyLarge: {
|
||||
...baseFont,
|
||||
fontSize: 16,
|
||||
lineHeight: 24,
|
||||
letterSpacing: 0.15,
|
||||
},
|
||||
bodyMedium: {
|
||||
...baseFont,
|
||||
fontSize: 14,
|
||||
lineHeight: 20,
|
||||
letterSpacing: 0.25,
|
||||
},
|
||||
bodySmall: {
|
||||
...baseFont,
|
||||
fontSize: 12,
|
||||
lineHeight: 16,
|
||||
letterSpacing: 0.4,
|
||||
},
|
||||
labelLarge: {
|
||||
...baseFont,
|
||||
fontSize: 14,
|
||||
lineHeight: 20,
|
||||
letterSpacing: 0.1,
|
||||
},
|
||||
labelMedium: {
|
||||
...baseFont,
|
||||
fontSize: 12,
|
||||
lineHeight: 16,
|
||||
letterSpacing: 0.5,
|
||||
},
|
||||
labelSmall: {
|
||||
...baseFont,
|
||||
fontSize: 11,
|
||||
lineHeight: 16,
|
||||
letterSpacing: 0.5,
|
||||
},
|
||||
default: {
|
||||
...baseFont,
|
||||
fontSize: 14,
|
||||
lineHeight: 20,
|
||||
letterSpacing: 0,
|
||||
},
|
||||
},
|
||||
}),
|
||||
};
|
||||
|
||||
// Светлая тема (на будущее)
|
||||
@ -77,6 +201,7 @@ export const lightTheme = {
|
||||
...MD3LightTheme.colors,
|
||||
...NavigationLightTheme.colors,
|
||||
},
|
||||
fonts: MD3LightTheme.fonts,
|
||||
};
|
||||
|
||||
// Экспортируем текущую тему
|
||||
|
Reference in New Issue
Block a user