Prevent Lottie from running in the background after navigating to other pages#48444
Prevent Lottie from running in the background after navigating to other pages#48444aldo-expensify merged 8 commits intoExpensify:mainfrom
Conversation
src/components/Lottie/index.tsx
Outdated
| // Prevent the animation from running in the background after navigating to other pages. | ||
| // See https://github.com/Expensify/App/issues/47273 | ||
| useEffect(() => { | ||
| if (!navigationContainerRef || !navigator) { |
There was a problem hiding this comment.
We should check navigationRef.isReady() before access getState
|
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
d0cd731 to
3bc4b18
Compare
|
@suneox It seems that the current approach has fixed the regression, so using Screenshots/Videos |
TY, I'll start checking now |
src/components/Lottie/index.tsx
Outdated
| const unsubscribeNavigationBlur = navigator.addListener('blur', () => { | ||
| const state = navigationContainerRef.getRootState(); | ||
| const targetRouteName = state?.routes?.[state?.index ?? 0]?.name; | ||
| if (targetRouteName !== NAVIGATORS.RIGHT_MODAL_NAVIGATOR) { |
There was a problem hiding this comment.
| if (targetRouteName !== NAVIGATORS.RIGHT_MODAL_NAVIGATOR) { | |
| if (![NAVIGATORS.RIGHT_MODAL_NAVIGATOR, NAVIGATORS.LEFT_MODAL_NAVIGATOR].includes(targetRouteName)) { |
There was a problem hiding this comment.
That will be better. Thanks for pointing it out!
| const navigator = useContext(NavigationContext); | ||
|
|
||
| useEffect(() => { | ||
| if (!browser || !navigationContainerRef || !navigator) { |
There was a problem hiding this comment.
Do we need to check browser?
There was a problem hiding this comment.
Because the issue only occurs in browsers, it seems unnecessary to apply this fix to native platforms.
There was a problem hiding this comment.
OK, let change the PR status
|
@QichenZhu The change looks good. We can update the status based on the suggestions above, and I have a question related to using the browser. |
|
@dangrous Sorry, but I'm not sure why Melvin involved you here. |
|
No worries - looks like this should be reviewed by @aldo-expensify ? |
|
Hi @dangrous I’ll be working on this PR |
|
ah @QichenZhu it looks like you just linked the PR like I'm removing myself for now, this should correctly assign @aldo-expensify when ready. |
Reviewer Checklist
Screenshots/VideosAndroid: NativeScreen.Recording.2024-09-11.at.01.03.26.mp4Android: mWeb ChromeScreen.Recording.2024-09-11.at.00.57.57.mp4iOS: NativeScreen.Recording.2024-09-11.at.00.59.29.mp4iOS: mWeb SafariScreen.Recording.2024-09-11.at.00.55.08.mp4MacOS: Chrome / SafariScreen.Recording.2024-09-11.at.00.51.34.mp4MacOS: DesktopScreen.Recording.2024-09-11.at.00.52.48.mp4 |
suneox
left a comment
There was a problem hiding this comment.
LGTM. I’ve verified this issue along with the regression issue.
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
| const unsubscribeNavigationBlur = navigator.addListener('blur', () => { | ||
| const state = navigationContainerRef.getRootState(); | ||
| const targetRouteName = state?.routes?.[state?.index ?? 0]?.name; | ||
| if (!isSideModalNavigator(targetRouteName)) { |
There was a problem hiding this comment.
The condition !isSideModalNavigator(targetRouteName) was introduced to exclude side modals on web/desktop platforms. However, the lack of an exception for small screens led to the issue here: #53208
Proposal: #53208 (comment)
PR: #55823






Details
Fixed Issues
$ #47273
PROPOSAL: #47273 (comment)
Tests
Expected result: The animation in the Settings tab should work, and the right-side modal should open.
Offline tests
Expected result: The animation in the Settings tab should work, and the right-side modal should open.
QA Steps
Expected result: The animation in the Settings tab should work, and the right-side modal should open.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
android-native.mp4
Android: mWeb Chrome
android-web.mp4
iOS: Native
ios-native.mp4
iOS: mWeb Safari
ios-web.mp4
MacOS: Chrome / Safari
mac-web.mp4
MacOS: Desktop
mac-desktop.mov