BugiDev / react-native-calendar-strip

Easy to use and visually stunning calendar component for React Native.
MIT License
936 stars 325 forks source link

Strange jump in the scroll of the strip #239

Open rdewolff opened 3 years ago

rdewolff commented 3 years ago

Does anyone have a similar issue ?

When I scroll the calendar-strip, there seems to be an unwanted render sometimes and jumping back to the begining.

unwanted-jump (duration: 23sec)

StackTraceYo commented 3 years ago

I too am seing this. Im noticing it when i use the minDate prop

rdewolff commented 3 years ago

I too am seing this. Im noticing it when i use the minDate prop

It seems to happen depending on some parameters. Did u find what’s causing this by any chance?

Anyone else?

rdewolff commented 3 years ago

Are you using the minDate props when that happens @StackTraceYo ?

StackTraceYo commented 3 years ago

Are you using the minDate props when that happens @StackTraceYo ?

@rdewolff yes I see it when I use that flag. I noted that in my original comment.

removing the minDate removes the issue - but id like to use it with minDate

rdewolff commented 3 years ago

Whoops sorry missed that. Just ran some test yesterday and noticed that and wanted to share.

peacechen commented 3 years ago

If you have time to debug, please submit a PR with a fix

DanielMalak commented 3 years ago

i also have the same issue because of minDate anyone has a workaround somehow ?? thanks

crisfast commented 3 years ago

Hello, I had the same problem. Also week arrows are not doing anything on android

      <CalendarStrip
        scrollable
        style={{ height: 90 }}
        minDate={moment()}
        onDateSelected={(newDate) => changeDate(newDate)}
        selectedDate={selectedDate}
        calendarHeaderStyle={styles.calendarHeader}
        dateNameStyle={styles.dateName}
        dateNumberStyle={styles.dateNumber}
        highlightDateNameStyle={styles.selectedDateName}
        highlightDateNumberStyle={styles.selectedDateNumber}
        weekendDateNameStyle={styles.dateName}
        weekendDateNumberStyle={styles.dateNumber}
        iconStyle={styles.arrowStyle}
        iconLeftStyle={styles.leftArrowStyle}
        iconRightStyle={styles.rightArrowStyle}
        locale={roCalendarConfig}
      />
peacechen commented 3 years ago

@crisfast I used as much as I could from your code snippet in the sample project and it works. You didn't provide the styles or locale, but that shouldn't affect the arrows. Please submit complete code using the sample project. I recommend opening another ticket for issues unrelated to the original issue in this thread.

naheed-shamim commented 11 months ago

One solution is to keep the current date at center, and disabling the previous dates.


const CALENDAR_MIN_DATE = moment().subtract(3, "days");
const CALENDAR_BLACKLIST_DATES = [
  {
    start: CALENDAR_MIN_DATE,
    end: moment().subtract(1, "day"),
  },
];

 <CalendarStrip
...
            minDate={CALENDAR_MIN_DATE}
            datesBlacklist={CALENDAR_BLACKLIST_DATES}
...

/>