diff --git a/src/calendar/day/basic/index.tsx b/src/calendar/day/basic/index.tsx index ae251e40b..1305ef7ae 100644 --- a/src/calendar/day/basic/index.tsx +++ b/src/calendar/day/basic/index.tsx @@ -5,7 +5,6 @@ import {Theme, DayState, MarkingTypes, DateData} from '../../../types'; import Marking, {MarkingProps} from '../marking'; import styleConstructor from './style'; - export interface BasicDayProps extends ViewProps { /** Theme object */ theme?: Theme; @@ -57,7 +56,15 @@ const BasicDay = (props: BasicDayProps) => { const isMultiDot = markingType === Marking.markings.MULTI_DOT; const isMultiPeriod = markingType === Marking.markings.MULTI_PERIOD; const isCustom = markingType === Marking.markings.CUSTOM; - + const weekDayStyles = { + 0: 'sunday', + 1: 'monday', + 2: 'tuesday', + 3: 'wednesday', + 4: 'thursday', + 5: 'friday', + 6: 'saturday' + }; const shouldDisableTouchEvent = () => { const {disableTouchEvent} = _marking; let disableTouch = false; @@ -83,6 +90,8 @@ const BasicDay = (props: BasicDayProps) => { } } else if (isToday) { styles.push(style.current.today); + } else if (typeof dateData?.weekDay === 'number' && weekDayStyles[dateData?.weekDay]) { + styles.push(style.current[weekDayStyles[dateData?.weekDay]]); } //Custom marking type @@ -111,6 +120,11 @@ const BasicDay = (props: BasicDayProps) => { styles.push(style.current.todayText); } else if (isInactive) { styles.push(style.current.inactiveText); + } else if (typeof dateData?.weekDay === 'number' && weekDayStyles[dateData?.weekDay]) { + const weekDayNumberTextStyle = `${weekDayStyles[dateData?.weekDay]}Text`; + if (style.current[weekDayNumberTextStyle]) { + styles.push(style.current[weekDayNumberTextStyle]); + } } // Custom marking type diff --git a/src/calendar/day/basic/style.ts b/src/calendar/day/basic/style.ts index f0350e435..5a2b75861 100644 --- a/src/calendar/day/basic/style.ts +++ b/src/calendar/day/basic/style.ts @@ -23,7 +23,6 @@ export default function styleConstructor(theme: Theme = {}) { backgroundColor: appStyle.selectedDayBackgroundColor, borderRadius: 16 }, - text: { fontSize: appStyle.textDayFontSize, fontFamily: appStyle.textDayFontFamily, @@ -45,7 +44,20 @@ export default function styleConstructor(theme: Theme = {}) { inactiveText: { color: appStyle.textInactiveColor }, - + sunday: {}, + sundayText: {}, + monday: {}, + mondayText: {}, + tuesday: {}, + tuesdayText: {}, + wednesday: {}, + wednesdayText: {}, + thursday: {}, + thursdayText: {}, + friday: {}, + fridayText: {}, + saturday: {}, + saturdayText: {}, ...(theme['stylesheet.day.basic'] || {}) }); } diff --git a/src/interface.ts b/src/interface.ts index 14ab054eb..1d1ac3b9d 100644 --- a/src/interface.ts +++ b/src/interface.ts @@ -15,7 +15,8 @@ export function xdateToData(date: XDate | string) { month: d.getMonth() + 1, day: d.getDate(), timestamp: new XDate(dateString, true).getTime(), - dateString: dateString + dateString: dateString, + weekDay: d.getDay() }; }