@@ -3,7 +3,7 @@ import { Text, TouchableRipple, useTheme } from 'react-native-paper'
33import { StyleSheet , View } from 'react-native'
44import DayRange from './DayRange'
55import { daySize } from './dateUtils'
6- import { useColorOnPrimaryBackground } from '../utils'
6+ import { useTextColorOnPrimary } from '../utils'
77
88function EmptyDayPure ( ) {
99 return < View style = { styles . empty } />
@@ -40,8 +40,12 @@ function Day(props: {
4040 const onPress = React . useCallback ( ( ) => {
4141 onPressDate ( new Date ( year , month , day ) )
4242 } , [ onPressDate , year , month , day ] )
43- const color = useColorOnPrimaryBackground ( )
44- const todayColor = theme . dark ? '#fff' : '#000'
43+ const color = useTextColorOnPrimary ( )
44+
45+ const borderColor =
46+ selected || ( inRange && theme . dark ) ? color : theme . dark ? '#fff' : '#000'
47+ const textColor = selected || ( inRange && theme . dark ) ? color : undefined
48+
4549 return (
4650 < View style = { [ styles . root ] } >
4751 < DayRange
@@ -62,16 +66,11 @@ function Day(props: {
6266 < View
6367 style = { [
6468 styles . day ,
65- isToday
66- ? { borderColor : selected || inRange ? color : todayColor }
67- : null ,
69+ isToday ? { borderColor : borderColor } : null ,
6870 selected ? { backgroundColor : primaryColor } : null ,
6971 ] }
7072 >
71- < Text
72- style = { selected || inRange ? { color } : null }
73- selectable = { false }
74- >
73+ < Text style = { textColor && { color : textColor } } selectable = { false } >
7574 { day }
7675 </ Text >
7776 </ View >
0 commit comments