-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[HOLD PR #49539][$250] Search-Different navigation when closing report via app back button and device back navigation #51192
Comments
Triggered auto assignment to @strepanier03 ( |
@strepanier03 FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors |
Edited by proposal-police: This proposal was edited at 2024-10-22 18:02:29 UTC. ProposalPlease re-state the problem that we are trying to solve in this issue.Different navigation when closing report via app back button and device back navigation What is the root cause of that problem?When navigating back from a chat opened in the Chats section—either by swiping (iOS) or using the back button (Android)—the topmost screen of the This issue does not occur when using the back button, as we use pop for navigation in that case App/src/pages/home/ReportScreen.tsx Line 283 in 21f7842
App/src/libs/Navigation/Navigation.ts Lines 265 to 276 in 21f7842
What changes do you think we should make in order to solve the problem?This issue using solution same with PR 48990 When navigating back from a chat opened in the Chats section to a chat opened in the Search section, we need to update the condition to pop Home from the Bottom Tab Navigator when the case of Report → Setting Workspace → BOTTOM_TAB_NAVIGATOR has Home as the topmost screen, ensuring the same behavior as when using the back button. Something like this: //.src/libs/Navigation/AppNavigator/beforeRemoveReportOpenedFromSearchRHP/index.native.ts#L25
function beforeRemoveReportOpenedFromSearchRHP(event: EventArg<'beforeRemove', true>) {
...
- const shouldPopHome =
- state.routes?.length >= 3 &&
- state.routes.at(-1)?.name === SCREENS.REPORT &&
- state.routes.at(-2)?.name === NAVIGATORS.RIGHT_MODAL_NAVIGATOR &&
- state.routes.at(-3)?.name === SCREENS.SEARCH.CENTRAL_PANE &&
- getTopmostBottomTabRoute(state)?.name === SCREENS.HOME;
+ const shouldPopHome =
+ (state.routes?.length >= 3 &&
+ state.routes.at(-1)?.name === SCREENS.REPORT &&
+ state.routes.at(-2)?.name === NAVIGATORS.RIGHT_MODAL_NAVIGATOR &&
+ state.routes.at(-3)?.name === SCREENS.SEARCH.CENTRAL_PANE &&
+ getTopmostBottomTabRoute(state)?.name === SCREENS.HOME) ||
+ (state.routes?.length >= 3 &&
+ state.routes.at(-1)?.name === SCREENS.REPORT &&
+ state.routes.at(-2)?.name === SCREENS.SETTINGS.WORKSPACES &&
+ state.routes.at(-3)?.name === NAVIGATORS.BOTTOM_TAB_NAVIGATOR &&
+ getTopmostBottomTabRoute(state)?.name === SCREENS.HOME);
...
} What alternative solutions did you explore? (Optional)For the general case, not a specific one, we don't need to check state.routes.at(-2)?.name so that other cases can use: //.src/libs/Navigation/AppNavigator/beforeRemoveReportOpenedFromSearchRHP/index.native.ts#L25
function beforeRemoveReportOpenedFromSearchRHP(event: EventArg<'beforeRemove', true>) {
...
- const shouldPopHome =
- state.routes?.length >= 3 &&
- state.routes.at(-1)?.name === SCREENS.REPORT &&
- state.routes.at(-2)?.name === NAVIGATORS.RIGHT_MODAL_NAVIGATOR &&
- state.routes.at(-3)?.name === SCREENS.SEARCH.CENTRAL_PANE &&
- getTopmostBottomTabRoute(state)?.name === SCREENS.HOME;
+ const shouldPopHome =
+ (state.routes?.length >= 3 &&
+ state.routes.at(-1)?.name === SCREENS.REPORT &&
+ state.routes.at(-2)?.name === NAVIGATORS.RIGHT_MODAL_NAVIGATOR &&
+ state.routes.at(-3)?.name === SCREENS.SEARCH.CENTRAL_PANE &&
+ getTopmostBottomTabRoute(state)?.name === SCREENS.HOME) ||
+ (state.routes?.length >= 3 &&
+ state.routes.at(-1)?.name === SCREENS.REPORT &&
+ state.routes.at(-3)?.name === NAVIGATORS.BOTTOM_TAB_NAVIGATOR &&
+ getTopmostBottomTabRoute(state)?.name === SCREENS.HOME);
...
} Here is test branch POC
Screen.Recording.2024-10-23.at.00.41.39.mov |
Edited by proposal-police: This proposal was edited at 2024-10-23 09:49:34 UTC. ProposalPlease re-state the problem that we are trying to solve in this issue.Back button/gesture behaviour does not match with on screen back button press behaviour on native apps. What is the root cause of that problem?When we go to the workspaces list page, we have "Home" and "Settings Root" in App/src/libs/Navigation/linkTo/index.ts Lines 95 to 112 in 45c44ee
When, we go back with back gesture/button on native apps, the routes are popped from the state. So, once the "Report" and "Settings Workspace" screens are popped, the "Home" screen is next. So, LHN shows up. But, when click on screen back button when on "Settings Workspace", we readjust the state popping the recently added "Home" screen above from the "BottomTabNavigator" to reach to "Settings Root", so it navigates to Settings page. App/src/libs/Navigation/Navigation.ts Lines 265 to 266 in e2d99b4
What changes do you think we should make in order to solve the problem?Earlier, we can open a report in "central pane" on narrow layouts only from Home or Report screens because reports could be accessed only from LHN or from FAB or from a report. In all these cases, the BottomTabNavigator topMostRoute was always Home. So, this condition never executed when the screen navigated to is a report App/src/libs/Navigation/linkTo/index.ts Line 107 in e2d99b4
so, the push action of another Home never happened. But, now, we can open report from other screens such as the workspace list page thanks to Search Router. Since, we can open report from any such screen, we would only want the report screen to be added to the state. We do not want to push another "Home" into BottomTabNavigator in these cases on narrow layouts because when we pop the last route before reaching BottomTabNavigator, we expect to navigate to the the bottom tab corresponding to this last route popped. App/src/libs/Navigation/linkTo/index.ts Line 108 in e2d99b4
to const bottomTabNavigatorRoute = rootState?.routes.findLast((route) => route.name === NAVIGATORS.BOTTOM_TAB_NAVIGATOR);
const homeExistsInBottomTab = bottomTabNavigatorRoute?.state?.routes.find((route) => route.name === SCREENS.HOME);
if (!(isNarrowLayout && homeExistsInBottomTab)) {
root.dispatch({ I think there is always "Home" in bottom tab even when begin from a deeplink, so we can omit the if (!(.... && matchingBottomTabRoute === SCREENS.HOME) What alternative solutions did you explore? (Optional) |
@strepanier03 Uh oh! This issue is overdue by 2 days. Don't forget to update your issues! |
@strepanier03 6 days overdue. This is scarier than being forced to listen to Vogon poetry! |
Got this tested and repro just fine. Looking at project and priority now. |
Job added to Upwork: https://www.upwork.com/jobs/~021851013558310537161 |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @ntdiary ( |
Oh, I missed considering that. 😃 We can consider restricting this only to native apps like this if (!(matchingBottomTabRoute === SCREENS.HOME && [CONST.PLATFORM.IOS, CONST.PLATFORM.ANDROID].includes(getPlatform())) Since clicking on browser back button adjusts state based on path, it adds suitable BottomTabNavigator to the state and this is not an issue for browsers. The OP also says that this bug exists only on native apps. |
Proposal updated
@ntdiary Could you check it again? I removed the |
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸 |
There isn't a perfect solution at the moment. I started a discussion in #49122, will provide an update in the next couple of days. Also, I'm still open to get a more perfect solution here. :) |
@ntdiary @strepanier03 this issue is now 4 weeks old, please consider:
Thanks! |
@ntdiary, @strepanier03 Huh... This is 4 days overdue. Who can take care of this? |
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸 |
@ntdiary, @strepanier03 6 days overdue. This is scarier than being forced to listen to Vogon poetry! |
@ntdiary, @strepanier03 Now this issue is 8 days overdue. Are you sure this should be a Daily? Feel free to change it! |
not overdue, waiting for navigation refactoring. :) |
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸 |
@ntdiary, @strepanier03 Uh oh! This issue is overdue by 2 days. Don't forget to update your issues! |
the refactoring PR #49539 is still in progress, maybe we can set this issue to |
If you don't want to wait, then let's go with my proposal. |
@ntdiary, @strepanier03 Eep! 4 days overdue now. Issues have feelings too... |
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸 |
@ntdiary, @strepanier03 Still overdue 6 days?! Let's take care of this! |
Personally, I'm ok to hold this for navigation refactoring. :) |
@ntdiary, @strepanier03 Uh oh! This issue is overdue by 2 days. Don't forget to update your issues! |
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸 |
Put on hold pending PR #49539 |
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Version Number: 9.0.51-2
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: N/A
**If this was caught during regression testing, add the test name, ID and link from TestRail:**N/A
Email or phone of affected tester (no customers): applausetester+kh081006@applause.expensifail.com
Issue reported by: Applause - Internal Team
Action Performed:
Expected Result:
App will return to Account settings when the report is opened in Workspaces and swiped to the right twice
Actual Result:
App will return to LHN when the report is opened in Workspaces and swiped to the right twice.
When performing similar steps using app back button, it returns to Account settings (Step 7)
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
Add any screenshot/video evidence
Bug6641270_1729532054815.ScreenRecording_10-22-2024_01-27-58_1.mp4
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @ntdiaryThe text was updated successfully, but these errors were encountered: