fix: pop all reports after screen resize#21312
Conversation
| // If already signed in, do not show the validate code if not on web, | ||
| // because we don't want to block the user with the interstitial page. | ||
| Navigation.goBack(false); | ||
| Navigation.goBack(); |
There was a problem hiding this comment.
This false was here for no reason also so I removed it.
There was a problem hiding this comment.
It's added for a reason, to unset the fallback and call navigationRef.current.goBack() instead of navigate(fallbackRoute, 'UP')
There was a problem hiding this comment.
But it doesn't work that way, the first argument is the route to go back to:
App/src/libs/Navigation/Navigation.js
Line 88 in 6183609
There was a problem hiding this comment.
Yes, but the fallback is not necessary. In this line we used to disable the fallback so the second condition won't be true (not to call navigate(fallbackRoute, 'UP')) and continue with the third option (navigationRef.current.goBack()).
There was a problem hiding this comment.
Ok, I get it now, thanks!
| * @param {Bool} shouldPopToTop - Should we navigate to LHN on back press | ||
| */ | ||
| function goBack(fallbackRoute = ROUTES.HOME, shouldEnforceFallback = false) { | ||
| function goBack(fallbackRoute = ROUTES.HOME, shouldPopToTop = false) { |
There was a problem hiding this comment.
We did not use the shouldEnforceFallback anywhere so I just changed it to a new prop
There was a problem hiding this comment.
We do use shouldEnforceFallback e.g. here
| let shouldPopAllStateOnUP = false; | ||
|
|
||
| function setShouldPopAllStateOnUP() { | ||
| shouldPopAllStateOnUP = true; | ||
| } |
There was a problem hiding this comment.
I think we might want to add some comment here too
|
Limited availability today but will get to this asap |
| * @param {Bool} shouldPopToTop - Should we navigate to LHN on back press | ||
| */ | ||
| function goBack(fallbackRoute = ROUTES.HOME, shouldEnforceFallback = false) { | ||
| function goBack(fallbackRoute = ROUTES.HOME, shouldPopToTop = false) { |
There was a problem hiding this comment.
We do use shouldEnforceFallback e.g. here
| // If already signed in, do not show the validate code if not on web, | ||
| // because we don't want to block the user with the interstitial page. | ||
| Navigation.goBack(false); | ||
| Navigation.goBack(); |
There was a problem hiding this comment.
It's added for a reason, to unset the fallback and call navigationRef.current.goBack() instead of navigate(fallbackRoute, 'UP')
| <HeaderView | ||
| reportID={reportID} | ||
| onNavigationMenuButtonClicked={() => Navigation.goBack(ROUTES.HOME)} | ||
| onNavigationMenuButtonClicked={() => Navigation.goBack(ROUTES.HOME, false, true)} |
There was a problem hiding this comment.
The ReportScreen may return HeaderView or MoneyRequestHeader. We need to apply same logic for MoneyRequestHeader
App/src/components/MoneyRequestHeader.js
Line 112 in 820fa93
|
@s77rt as mentioned here: #20370 (comment), the browser back button will work like this and I would be very hesitant from trying to change that behavior, but cc @parasharrajat since @mountiny is ooo iirc. |
|
Looks we are okay to move with this. @WoLewicki Can you please resolve the conflicts? |
|
@s77rt done, thanks. |
Reviewer Checklist
Screenshots/VideosWebweb.mp4Mobile Web - ChromeMobile Web - SafariDesktopdesktop.mp4iOSAndroid |
mountiny
left a comment
There was a problem hiding this comment.
Thanks everyone for patience when I was ooo and working on this!
| firstRenderRef.current = false; | ||
| return; | ||
| } | ||
| if (!props.isSmallScreenWidth) { |
There was a problem hiding this comment.
This props have been deprecated since we are using the windows hook now to get the value so we need to update this
|
🚀 Deployed to staging by https://github.com/mountiny in version: 1.3.37-0 🚀
|
|
🚀 Deployed to production by https://github.com/Julesssss in version: 1.3.37-7 🚀
|
Details
After the screen resizes to small, and we already navigated through some reports, we still want the back button of report's header to go to LHN, so we pop all of the chats in order to do it. We also don't want to replicate that after user starts navigating deeper while stying on the small-sized screen.
Fixed Issues
$ #20370
Tests
Offline tests
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.src/languages/*files and using the translation methodWaiting for Copylabel for a copy review on the original GH to get the correct copy.STYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)/** comment above it */thisproperly so there are no scoping issues (i.e. foronClick={this.submit}the methodthis.submitshould be bound tothisin the constructor)thisare necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);ifthis.submitis never passed to a component event handler likeonClick)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)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
Web
nav1.mp4
nav2.mp4
nav3.mov
Mobile Web - Chrome
Mobile Web - Safari
Desktop
iOS
Android