From 7a75293a16dc41e8ea114af63aaeb752c4afd5d4 Mon Sep 17 00:00:00 2001 From: Alexander Zinchuk Date: Mon, 13 Feb 2023 03:32:41 +0100 Subject: [PATCH] Reaction Selector: Fix broken scroll --- src/components/middle/message/ReactionSelector.tsx | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/components/middle/message/ReactionSelector.tsx b/src/components/middle/message/ReactionSelector.tsx index 4b62519fa..8e43ed733 100644 --- a/src/components/middle/message/ReactionSelector.tsx +++ b/src/components/middle/message/ReactionSelector.tsx @@ -1,5 +1,5 @@ import React, { - memo, useLayoutEffect, useMemo, useRef, + memo, useMemo, useRef, } from '../../../lib/teact/teact'; import type { FC } from '../../../lib/teact/teact'; @@ -13,7 +13,6 @@ import { IS_COMPACT_MENU } from '../../../util/environment'; import { isSameReaction, canSendReaction, getReactionUniqueKey } from '../../../global/helpers'; import useHorizontalScroll from '../../../hooks/useHorizontalScroll'; -import useFlag from '../../../hooks/useFlag'; import ReactionSelectorReaction from './ReactionSelectorReaction'; @@ -44,15 +43,9 @@ const ReactionSelector: FC = ({ }) => { // eslint-disable-next-line no-null/no-null const itemsScrollRef = useRef(null); - const [isHorizontalScrollEnabled, enableHorizontalScroll] = useFlag(false); - useHorizontalScroll(itemsScrollRef, !isHorizontalScrollEnabled); - - useLayoutEffect(() => { - enableHorizontalScroll(); - }, [enableHorizontalScroll]); + useHorizontalScroll(itemsScrollRef); const handleWheel = (e: React.WheelEvent | React.TouchEvent) => { - if (!itemsScrollRef) return; const deltaY = 'deltaY' in e ? e.deltaY : getTouchY(e); if (deltaY && e.cancelable) {