Custom Emoji Modal: Fix icons playback on second opening (#2822)

This commit is contained in:
Alexander Zinchuk 2023-03-19 22:31:35 -05:00
parent e3269baf14
commit 033422581b

View File

@ -10,6 +10,7 @@ import buildClassName from '../../util/buildClassName';
import { useIntersectionObserver } from '../../hooks/useIntersectionObserver';
import usePrevious from '../../hooks/usePrevious';
import useLang from '../../hooks/useLang';
import Modal from '../ui/Modal';
import StickerSetCard from './StickerSetCard';
@ -30,10 +31,13 @@ const CustomEmojiSetsModal: FC<OwnProps & StateProps> = ({
onClose,
}) => {
const { openStickerSet } = getActions();
const lang = useLang();
// eslint-disable-next-line no-null/no-null
const customEmojiModalRef = useRef<HTMLDivElement>(null);
const { observe: observeIntersectionForCovers } = useIntersectionObserver({ rootRef: customEmojiModalRef });
const { observe: observeIntersectionForCovers } = useIntersectionObserver({
rootRef: customEmojiModalRef, isDisabled: !customEmojiSets,
});
const prevCustomEmojiSets = usePrevious(customEmojiSets);
const renderingCustomEmojiSets = customEmojiSets || prevCustomEmojiSets;
@ -50,9 +54,9 @@ const CustomEmojiSetsModal: FC<OwnProps & StateProps> = ({
className={styles.root}
onClose={onClose}
hasCloseButton
title="Sets of used emoji"
title={lang('lng_custom_emoji_used_sets')}
>
<div className={buildClassName(styles.sets, 'custom-scroll')} ref={customEmojiModalRef}>
<div className={buildClassName(styles.sets, 'custom-scroll')} ref={customEmojiModalRef} teactFastList>
{renderingCustomEmojiSets?.map((customEmojiSet) => (
<StickerSetCard
key={customEmojiSet.id}