Sticker View: Fix confilicting lottie animations

This commit is contained in:
Alexander Zinchuk 2022-11-01 18:53:20 +01:00
parent 4c97d37439
commit d2029a989f
2 changed files with 5 additions and 5 deletions

View File

@ -102,12 +102,10 @@ const AnimatedSticker: FC<OwnProps> = ({
return;
}
const fullId = `${id || generateIdFor(ID_STORE, true)}_${size}${color ? `_${color.join(',')}` : ''}`;
const newAnimation = RLottie.init(
containerRef.current,
onLoad,
fullId,
id || generateIdFor(ID_STORE, true),
tgsUrl,
{
noLoop,

View File

@ -99,6 +99,8 @@ const StickerView: FC<OwnProps> = ({
// Preload preview for Message Input and local message
useMedia(previewMediaHash, !shouldLoad || !shouldPreloadPreview, undefined, cacheBuster);
const idKey = [id, size, customColor?.join(',')].filter(Boolean).join('_');
return (
<>
<img
@ -108,8 +110,8 @@ const StickerView: FC<OwnProps> = ({
/>
{isLottie ? (
<AnimatedSticker
key={customColor?.join(',')}
id={id}
key={idKey}
id={idKey}
size={size}
className={buildClassName(styles.media, fullMediaClassName, fullMediaClassNames)}
tgsUrl={fullMediaData}