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 +80,20 @@ function Lottie({source, webStyle, shouldLoadAfterInteractions, ...props}: Props
79
80
returnunsubscribeNavigationBlur;
80
81
},[browser,navigationContainerRef,navigator]);
81
82
83
+
// If user is being navigated away, let pause the animation to prevent memory leak.
84
+
// see issue: https://github.com/Expensify/App/issues/36645
85
+
useEffect(()=>{
86
+
if(!animationRef.current||!hasNavigatedAway){
87
+
return;
88
+
}
89
+
animationRef?.current?.pause();
90
+
},[hasNavigatedAway]);
91
+
82
92
// 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
93
// we'll just render an empty view as the fallback to prevent
84
-
// 1. memory leak, see issue: https://github.com/Expensify/App/issues/36645
85
-
// 2. heavy rendering, see issues: https://github.com/Expensify/App/issues/34696 and https://github.com/Expensify/App/issues/47273
86
-
// 3. lag on react navigation transitions, see issue: https://github.com/Expensify/App/issues/44812
0 commit comments