Today text color does not change when disabled
Description
I bumped from 1.1284.0 to 1.1303.0 and noticed Today text color does not change when it's disabled. Though, it works fine for other disabled dates.
This issue doesn't exist in 1.1284.0 version.
Expected Behavior
It should change Today text color to textDisabledColor.
Observed Behavior
Setting textDisabledColor in theme doesn't change today text color to grey.
Environment
Please run these commands in the project folder and fill in their results:
-
npm ls react-native-calendars: -
npm ls react-native:
Also specify:
- Device/emulator/simulator & OS version: Android OnePluse
Reproducible Demo
Please provide a minimized reproducible demonstration of the problem you're reporting.
Issues that come with minimal repro's are resolved much more quickly than issues where a maintainer has to reproduce themselves.
Screenshots
@fadi-quader-mox How did you manage to fix this ?
@kashif-sk unfortunately, i couldn't fix it!
@fadi-quader-mox So can you please keep this issue open so that someone can help with a fix
This may related to code that define "day state" day-state-manager.ts and how it apply the day style src/calendar/day/basic/index.tsx. As "day-state-manager.ts" uses if-else condition that if day is in "today" state, other "disable" state will be ignored. So day style will always select today's style.
I have a simple workaround to dynamically set the todayTextColor depending on whether the calendar's minDate matches today's date. This improves the UI feedback by highlighting today's date in blue "#2d4150" only when it is selectable, otherwise using a muted gray "#d9e1e8"".
How it works:
- Get today's date in YYYY-MM-DD format using dayjs()
- Compare with minDate
- Conditionally set todayTextColor in the calendar theme
const today = dayjs().format("YYYY-MM-DD");
const isTodayMinDate = minDate === today;
<Calendar
minDate={minDate}
theme={{
todayTextColor: isTodayMinDate ? "#2d4150" : "#d9e1e8""
}}
/>
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.