Skip to content
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

RTL breaks the scrolling in the WeekCalendar component #2509

Open
InkAndSteel opened this issue Aug 15, 2024 · 0 comments
Open

RTL breaks the scrolling in the WeekCalendar component #2509

InkAndSteel opened this issue Aug 15, 2024 · 0 comments

Comments

@InkAndSteel
Copy link

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

Screen_Recording_20240815_171921_Nia.Dev.mp4
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