Forum Panel: Support swipe-to-close for RTL languages (#2250)

This commit is contained in:
Alexander Zinchuk 2023-01-08 02:43:57 +01:00
parent 930f82eb65
commit 89a5647fd4

View File

@ -154,7 +154,9 @@ const ForumPanel: FC<OwnProps & StateProps> = ({
return captureEvents(ref.current!, { return captureEvents(ref.current!, {
selectorToPreventScroll: '.chat-list', selectorToPreventScroll: '.chat-list',
onSwipe: ((e, direction) => { onSwipe: ((e, direction) => {
if (direction === SwipeDirection.Right) { const closeDirection = lang.isRtl ? SwipeDirection.Left : SwipeDirection.Right;
if (direction === closeDirection) {
closeForumPanel(); closeForumPanel();
return true; return true;
} }
@ -162,7 +164,7 @@ const ForumPanel: FC<OwnProps & StateProps> = ({
return false; return false;
}), }),
}); });
}, [closeForumPanel]); }, [closeForumPanel, lang.isRtl]);
function renderTopics() { function renderTopics() {
const viewportOffset = orderedIds!.indexOf(viewportIds![0]); const viewportOffset = orderedIds!.indexOf(viewportIds![0]);