Animated Sticker: Avoid initializing RLottie after unmount
This commit is contained in:
parent
05f00511e5
commit
a087e7a429
@ -97,12 +97,23 @@ const AnimatedSticker: FC<OwnProps> = ({
|
||||
const playSegmentRef = useRef<[number, number]>();
|
||||
playSegmentRef.current = playSegment;
|
||||
|
||||
const isUnmountedRef = useRef();
|
||||
useEffect(() => {
|
||||
return () => {
|
||||
isUnmountedRef.current = true;
|
||||
};
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (animation || !tgsUrl || (sharedCanvas && !sharedCanvasCoords)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const exec = () => {
|
||||
if (isUnmountedRef.current) {
|
||||
return;
|
||||
}
|
||||
|
||||
const container = containerRef.current || sharedCanvas;
|
||||
if (!container) {
|
||||
return;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user