You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -79,19 +79,20 @@ function Lottie({source, webStyle, shouldLoadAfterInteractions, ...props}: Props
79
79
returnunsubscribeNavigationBlur;
80
80
},[browser,navigationContainerRef,navigator]);
81
81
82
+
// If user is being navigated away, let pause the animation to prevent memory leak.
83
+
useEffect(()=>{
84
+
if(!animationRef.current||!hasNavigatedAway){
85
+
return;
86
+
}
87
+
animationRef?.current?.pause();
88
+
},[hasNavigatedAway]);
89
+
82
90
// If the page navigates to another screen, the image fails to load, app is in background state, animation file isn't ready, or the splash screen isn't hidden yet,
83
91
// we'll just render an empty view as the fallback to prevent
84
92
// 1. memory leak, see issue: https://github.com/Expensify/App/issues/36645
85
93
// 2. heavy rendering, see issues: https://github.com/Expensify/App/issues/34696 and https://github.com/Expensify/App/issues/47273
86
94
// 3. lag on react navigation transitions, see issue: https://github.com/Expensify/App/issues/44812
0 commit comments