react-native-calendars icon indicating copy to clipboard operation
react-native-calendars copied to clipboard

RTL breaks the scrolling in the WeekCalendar component

Open InkAndSteel opened this issue 1 year ago • 0 comments

Description

Our App supports Arabic. To do that, we use ReactNatives RTL feature. When RTL is activated, selecting a date in a week that is different from the week of the selected date, causes the FlatList to scroll in the opposite direction. The responsible code is here:

// node_modules/react-native-calendars/src/expandableCalendar/WeekCalendar/new.js useEffect(() => { if (updateSource !== UpdateSources.WEEK_SCROLL) { const pageIndex = items.findIndex(item => sameWeek(item, date, firstDay)); // @ts-expect-error list.current?.scrollToOffset?.(pageIndex * containerWidth, 0, false); } }, [date]);

If I remove this, everything works as expected.

Expected Behavior

When I select a date in the week calendar, the WeekCalendar component should not scroll at all (because the date I selected is already in View).

Observed Behavior

The Week calendar scrolls in the opposite direction.

Environment

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

Also specify:

I am on Android, physical device

https://github.com/user-attachments/assets/007f2649-baa4-4cdb-a0a4-1bfcd407e5a9

InkAndSteel avatar Aug 15 '24 15:08 InkAndSteel