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; return;
} }
const fullId = `${id || generateIdFor(ID_STORE, true)}_${size}${color ? `_${color.join(',')}` : ''}`;
const newAnimation = RLottie.init( const newAnimation = RLottie.init(
containerRef.current, containerRef.current,
onLoad, onLoad,
fullId, id || generateIdFor(ID_STORE, true),
tgsUrl, tgsUrl,
{ {
noLoop, noLoop,

View File

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