|
1 | 1 | import * as React from 'react' |
2 | 2 | import { View, StyleSheet } from 'react-native' |
3 | | -import { IconButton, Text } from 'react-native-paper' |
| 3 | +import { IconButton, Text, useTheme } from 'react-native-paper' |
4 | 4 | import type { ModeType } from './Calendar' |
5 | 5 | import type { LocalState } from './DatePickerModalContent' |
6 | 6 | import { useHeaderTextColor } from '../utils' |
7 | 7 | import Color from 'color' |
8 | 8 | import { getTranslation } from '../translations/utils' |
| 9 | +import type { |
| 10 | + Fonts, |
| 11 | + MD3Typescale, |
| 12 | +} from 'react-native-paper/lib/typescript/types' |
9 | 13 |
|
10 | 14 | export interface HeaderPickProps { |
11 | 15 | moreLabel?: string |
@@ -61,15 +65,22 @@ export default function DatePickerModalContentHeader( |
61 | 65 | editIcon = 'pencil', |
62 | 66 | calendarIcon = 'calendar', |
63 | 67 | } = props |
64 | | - |
| 68 | + const theme = useTheme() |
65 | 69 | const label = getLabel(props.locale, props.mode, props.label) |
66 | 70 |
|
67 | 71 | const color = useHeaderTextColor() |
68 | 72 | const allowEditing = mode !== 'multiple' |
| 73 | + |
| 74 | + let textFont = (theme.fonts as Fonts)?.medium |
| 75 | + |
| 76 | + if (theme.isV3) { |
| 77 | + textFont = (theme.fonts as MD3Typescale)?.bodyLarge |
| 78 | + } |
| 79 | + |
69 | 80 | return ( |
70 | 81 | <View style={[styles.header]}> |
71 | 82 | <View> |
72 | | - <Text style={[styles.label, { color }]}> |
| 83 | + <Text style={[styles.label, { color, ...textFont }]}> |
73 | 84 | {uppercase ? label.toUpperCase() : label} |
74 | 85 | </Text> |
75 | 86 | <View style={styles.headerContentContainer}> |
@@ -97,7 +108,7 @@ export default function DatePickerModalContentHeader( |
97 | 108 | ? getTranslation(props.locale, 'typeInDate') |
98 | 109 | : getTranslation(props.locale, 'pickDateFromCalendar') |
99 | 110 | } |
100 | | - color={color} |
| 111 | + iconColor={color} |
101 | 112 | onPress={onToggle} |
102 | 113 | /> |
103 | 114 | ) : null} |
|
0 commit comments