wix / react-native-calendars

React Native Calendar Components 🗓️ 📆
MIT License
9.52k stars 2.95k forks source link

CalendarProvider triggers PageScroll and changes week #2265

Open JuliaSzymanskaFirmao opened 1 year ago

JuliaSzymanskaFirmao commented 1 year ago

Description

I use CalendarProvider with ExpandableCalendar and TimelineList.

Expected Behavior

When I enter into the screen with calendar it should open at today date (specified by currentDate).

Observed Behavior

Sometimes, the CalendarProvider triggers the "pageScroll" action and reverts to the previous week, despite setting the date property correctly (my currentDate variable remains today). How can I prevent it from going back a week?

Environment

Please run these commands in the project folder and fill in their results:

Also specify:

  1. Device/emulator/simulator & OS version: Device & emulator & simulator - Android 13 (on other version also)

Reproducible Demo

const [currentDate, setCurrentDate] = React.useState<string>(getDate());
  <CalendarProvider
            date={currentDate}
            onDateChanged={onDateChanged}
            onMonthChange={onMonthChange}
            showTodayButton
            timelineLeftInset={55}
        >
            <ExpandableCalendar
                firstDay={1}
                date={currentDate}
                markedDates={eventEntries.marked}
                animateScroll
            />
            <TimelineList
              events={groupEventsByDay(eventEntries.timeEntries)}
              timelineProps={{
                  format24h: true,
                  start: 0,
                  end: 24,
                  overlapEventsSpacing: 6,
                  rightEdgeSpacing: 8,
                  renderEvent: (event) => {
                      return <CalendarEvent event={event} handleOnPress={handleOnEventPress} />;
                  },
              }}
              showNowIndicator
              scrollToNow
          />
/>

Screenshots

Github

stale[bot] commented 12 months ago

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.