From 4dbd186deaa8f211903e993b68ef2c8bf04bd2e3 Mon Sep 17 00:00:00 2001 From: Nitzan Yizhar Date: Sun, 23 Mar 2025 15:31:23 +0200 Subject: [PATCH 1/3] refactor: comment out unused RTL scrolling logic in useScrollTo hook --- src/hooks/useScrollTo/index.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/hooks/useScrollTo/index.ts b/src/hooks/useScrollTo/index.ts index 4e39cf99d5..bd4fd74613 100644 --- a/src/hooks/useScrollTo/index.ts +++ b/src/hooks/useScrollTo/index.ts @@ -62,16 +62,16 @@ const useScrollTo = (props: ScrollToProps): [horizontal]); const scrollTo = useCallback((offset: number, animated = true) => { - if ( - horizontal && - Constants.isRTL && - Constants.isAndroid && - !_.isUndefined(contentSize.current) && - !_.isUndefined(containerSize.current) - ) { - const scrollingWidth = Math.max(0, contentSize.current - containerSize.current); - offset = scrollingWidth - offset; - } + // if ( + // horizontal && + // Constants.isRTL && + // Constants.isAndroid && + // !_.isUndefined(contentSize.current) && + // !_.isUndefined(containerSize.current) + // ) { + // const scrollingWidth = Math.max(0, contentSize.current - containerSize.current); + // offset = scrollingWidth - offset; + // } // @ts-ignore if (_.isFunction(scrollViewRef.current?.scrollToOffset)) { From 28a9251a2ea847d99e99d852749a075218080060 Mon Sep 17 00:00:00 2001 From: Nitzan Yizhar Date: Sun, 23 Mar 2025 15:38:19 +0200 Subject: [PATCH 2/3] refactor: remove unused import from useScrollTo hook --- src/hooks/useScrollTo/index.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/hooks/useScrollTo/index.ts b/src/hooks/useScrollTo/index.ts index bd4fd74613..b787ed966b 100644 --- a/src/hooks/useScrollTo/index.ts +++ b/src/hooks/useScrollTo/index.ts @@ -1,7 +1,6 @@ import _ from 'lodash'; import {RefObject, useCallback, useRef} from 'react'; import {ScrollView, FlatList, LayoutChangeEvent} from 'react-native'; -import {Constants} from '../../commons/new'; export type ScrollToSupportedViews = ScrollView | FlatList; From cbf8d0848b6773816eb01cd181d8fc3b3d71b045 Mon Sep 17 00:00:00 2001 From: Nitzan Yizhar Date: Sun, 23 Mar 2025 16:19:26 +0200 Subject: [PATCH 3/3] Added comment --- src/hooks/useScrollTo/index.ts | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/hooks/useScrollTo/index.ts b/src/hooks/useScrollTo/index.ts index b787ed966b..759f5dc087 100644 --- a/src/hooks/useScrollTo/index.ts +++ b/src/hooks/useScrollTo/index.ts @@ -61,16 +61,17 @@ const useScrollTo = (props: ScrollToProps): [horizontal]); const scrollTo = useCallback((offset: number, animated = true) => { - // if ( - // horizontal && - // Constants.isRTL && - // Constants.isAndroid && - // !_.isUndefined(contentSize.current) && - // !_.isUndefined(containerSize.current) - // ) { - // const scrollingWidth = Math.max(0, contentSize.current - containerSize.current); - // offset = scrollingWidth - offset; - // } + // Fix that was for Android RTL. Scrolling is now aligned between IOS and Android and offset is ok. + /* if ( + horizontal && + Constants.isRTL && + Constants.isAndroid && + !_.isUndefined(contentSize.current) && + !_.isUndefined(containerSize.current) + ) { + const scrollingWidth = Math.max(0, contentSize.current - containerSize.current); + offset = scrollingWidth - offset; + } */ // @ts-ignore if (_.isFunction(scrollViewRef.current?.scrollToOffset)) {