-
Couldn't load subscription status.
- Fork 3.1k
Open
Description
Description
When using inside a with animateScroll enabled, updating the selected date via state (setSelectedDate) does not update the calendar display correctly. The shown date does not match the new selected date. Disabling the animateScroll prop restores the expected behavior and the calendar updates properly when the date changes.
Example
const [selectedDate, setSelectedDate] = useState('2025-09-18');
<CalendarProvider date={selectedDate}>
<ExpandableCalendar
animateScroll
onCalendarToggled={setCalendarPosition}
onDayPress={handleSelectDate}
firstDay={1}
/>
<View>
<Text>Current date: {selectedDate}</Text>
<Button title="Change date to 2026-04-11" onPress={() => setSelectedDate('2026-04-11')} />
</View>
</CalendarProvider>Steps to Reproduce
- Render the code above.
- Click the button to change the date to 2026-04-11.
- Observe that the calendar does not update visually to the new date unless animateScroll is disabled.
Expected Behavior
The calendar should immediately display the newly selected date after setSelectedDate, even when animateScroll is enabled.
Actual Behavior
Calendar display does not update and shows an incorrect date after changing selectedDate state while animateScroll is active.
Environment
- react-native: 0.81.4
- react-native-calendars: 1.1313.0
- react: 19.1.0
- expo: 54.0.8
Metadata
Metadata
Assignees
Labels
No labels
