Skip to content

🐛 Bug Report: ExpandableCalendar incorrectly detects date changed after toggling the calendar #2613

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
ucaboro opened this issue Mar 5, 2025 · 1 comment

Comments

@ucaboro
Copy link

ucaboro commented Mar 5, 2025

Description
When collapsing the calendar into a week and tapping the date it sometimes gets incorrectly detected and moves to a different month.

Steps To Reproduce
Steps to reproduce the behavior:

  1. Go to e.g. March 2025 and expand the calendar
  2. Tap on a date (e.g. 11th March)
  3. Collapse the calendar
  4. Tap on the same date (e.g. 11th March)

Screenshots / Recording

rnc_bug_report.mov

Code Snippet
For a minimal, reproducible example just use a plain ExpandableCalendar wrapped in a Provider.

<CalendarProvider date={today} showTodayButton={false}>
  <ExpandableCalendar
    disableWeekScroll={true}
    onDayPress={console.log}
    onMonthChange={console.log}
  />
</CalendarProvider>;

Expected Behavior
11th March keep being selected with onDayPress triggered.

Observed Behavior
26th Feb is selected with both onMonthChange and onDayPress being triggered.

Environment (please complete the following information):

"react-native-calendars": "^1.1307.0",
"react-native": "0.74.5",
"expo": "~51.0.38",
Platform: Android & iOS
Device/Emulator: Attached reference from iOS simulator iPhone 13, iOS 15.2

@ucaboro
Copy link
Author

ucaboro commented Mar 5, 2025

Investigated the bug and created PR with a fix

TLDR: the bug is due to the fact that both WeekCalendar and CalendarList are used together, where the animation in bounceToPosition is unsynced from position tracking state.

For anybody experiencing the same issue I recommend fixing it manually and patching it using react-native-patch, while the PR is not merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant