Skip to content

Commit e0703bd

Browse files
fix: fix for #192
1 parent 9254669 commit e0703bd

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

example/src/App.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -571,6 +571,7 @@ export default function AppWithProviders() {
571571
const [materialYouEnabled, setMaterialYouEnabled] = React.useState(true)
572572
const m3Theme = colorScheme === 'dark' ? MD3DarkTheme : MD3LightTheme
573573
const m2Theme = colorScheme === 'dark' ? MD2LightTheme : MD2LightTheme
574+
574575
return (
575576
<SafeAreaProvider>
576577
<PaperProvider theme={materialYouEnabled ? m3Theme : m2Theme}>

src/Time/TimePickerModal.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export function TimePickerModal({
4848
hours,
4949
minutes,
5050
label = 'Select time',
51-
uppercase = true,
51+
uppercase: _uppercase,
5252
cancelLabel = 'Cancel',
5353
confirmLabel = 'Ok',
5454
animationType = 'none',
@@ -77,7 +77,8 @@ export function TimePickerModal({
7777
defaultInputType?: PossibleInputTypes
7878
}) {
7979
const theme = useTheme()
80-
80+
const defaultUppercase = !theme.isV3
81+
const uppercase = _uppercase ?? defaultUppercase
8182
let textFont
8283
let labelText = label
8384

src/Time/timeUtils.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,12 +231,17 @@ export function useInputColors(highlighted: boolean) {
231231
? theme.colors.onPrimaryContainer
232232
: theme.colors.onBackground
233233
} else {
234+
const t = theme as any as MD2Theme
234235
if (highlighted && !theme.dark) {
235-
return theme.colors.primary
236+
const primary = Color(t.colors.primary)
237+
const background = Color(backgroundColor)
238+
return background.isDark() && primary.isDark()
239+
? '#ffffffff'
240+
: t.colors.primary
236241
}
237242
return (theme as any as MD2Theme).colors.text
238243
}
239-
}, [highlighted, theme])
244+
}, [highlighted, theme, backgroundColor])
240245

241246
return { backgroundColor, color }
242247
}

0 commit comments

Comments
 (0)