Skip to content
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

Fix: back handler for Drawer #5745

Merged
merged 18 commits into from
Nov 1, 2021
Merged

Conversation

parasharrajat
Copy link
Member

@parasharrajat parasharrajat commented Oct 10, 2021

Details

Issues

  • We have to click twice on the LHN to go to any chat.
  • When we resize the page LHN and Report body is not correctly aligned.
  • Drawer does not open on Mobile Web.

Fixed Issues

$ #4211
$ #5971

Tests | QA Steps

#4211

  1. Open LHN on Android.
  2. navigate to a report.
  3. Use the back button on the Android device.
  4. You should land on LHN.
  5. Use the back button on the Android device.
  6. App should be closed.

#5971

There are no clear instructions for testing it but I believe this PR will fix this issue due to the reason that we are using upgraded Drawer Lib. The new version has removed transformation from the View for the permanent drawer which means it should remain static.

  1. Follow the reproduction steps mentioned on the issue.
  2. Or, Try to resize the Browser window multiple times to observe that the layout does not break.

Tested On

  • Web
  • Mobile Web
  • Desktop
  • iOS
  • Android

Screenshots

Web

Mobile Web

Desktop

iOS

Android

@parasharrajat parasharrajat requested a review from a team as a code owner October 10, 2021 17:09
@MelvinBot MelvinBot requested review from Beamanator and removed request for a team October 10, 2021 17:09
@parasharrajat
Copy link
Member Author

One issue that I found is when we open the Workspace Settings route, it does not open the Card page at the click of the Card link. This is known to me and I am fixing it #5131 here.

Beamanator
Beamanator previously approved these changes Oct 11, 2021
Copy link
Contributor

@Beamanator Beamanator left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests are looking great!

One weird Android thing I noticed: When viewing the app in the simulator, I have to press twice on any report to navigate to it. Once I navigate to a report I can close it and navigate to it again with one click, but if I close and want to navigate to a new report I have to click that report twice :( But it looks like that's also happening on main so not caused by this 👍

Still can't merge b/c n6 hold

@parasharrajat
Copy link
Member Author

The PR which I mentioned in the above comment is solving this.

@Beamanator
Copy link
Contributor

@parasharrajat Sorry, which PR are you thinking will fix the issue I mentioned?

@parasharrajat
Copy link
Member Author

#5131

@Beamanator
Copy link
Contributor

Ok I trust you 😅 your comment here & the test steps in #5131 didn't really look super related to what I mentioned, but it's fine, I know this PR didn't cause the issue 👍

@parasharrajat
Copy link
Member Author

Well, don't trust me on this. Your issue is indeed different. Didn't get a good look from Cellphone.

I will check that later with your reproduction steps.

@Beamanator
Copy link
Contributor

Aah ok 😆 I'll post in #expensify-open-source to see if others saw the same issue recently

@parasharrajat
Copy link
Member Author

@Beamanator Do not merge it yet. I have to test something.

@parasharrajat
Copy link
Member Author

parasharrajat commented Oct 18, 2021

All right.

It will cause two new issues.

  • We have to click twice on the LHN to go to any chat.
  • When we resize the page LHN and Report body are not correctly aligned.

@Beamanator What should I do now?

@Beamanator
Copy link
Contributor

Beamanator commented Oct 19, 2021

@parasharrajat I just tested this fork again and noticed:

  1. Needing to click twice on the LHN wasn't happening for me! That's a good sign 👍
  2. If you resize the page so whole page is the report body, then expand so you should see the LHN again, the LHN disappears
    • Tested this on main, I didn't see this happen. I don't see how this could have happened due to adding backBehavior="none", could it have been caused by something else in the libraries you updated in this PR?
    • I removed backBehavior="none" on your fork and re-tested, saw the same thing. Can you check if this has been reported in react-navigation?

@parasharrajat
Copy link
Member Author

parasharrajat commented Oct 19, 2021

I looked at the diff between the versions.

There are a couple of changes which can be directly the cause of our issues.

  1. History for the Drawer is changed. # 1
  2. There are a couple of changes for the drawer-type parmanant. react-navigation/react-navigation@2a88d0d

I think the first can be fixed directly in our app. We are managing the state ourself and thus we could be wrong somewhere.

For 2, I am yet to analyze the changes and their effect.

@parasharrajat
Copy link
Member Author

parasharrajat commented Oct 20, 2021

OK, @Beamanator I have to open another issue with R-navigation for 2 on the above list 👨 🔫 . It's clearly a regression from the above commit.

My suggestion

  1. I think the work here for 4211 and 5027 is done. So those two milestone should be considered completed (Upwork).
  2. Now we have two more issues which is blocking this PR.
  3. I can try to fix the first one. A new milestone as this is a new issue.
  4. For point 2, I have to open another issue and provide reproduction and cooperate with maintainers to fix that. This is additional work for me and you know how tedious it could be, so I request separate milestone for this as well.

We can hold the payment for all the above until this PR and other issues are fixed.

What do you suggest as the best path forward?

@Beamanator
Copy link
Contributor

Beamanator commented Oct 20, 2021

Great ideas @parasharrajat , I definitely like this path to move forward, and I agree that you've already completed a few milestones and we should open a few more. Here's what I'm thinking (almost exactly what you mentioned, plus one milestone you missed, and I want to confirm with Rory about #5027)

Milestones / tasks completed

New milestones / tasks

  • Submit issue in react-navigation to fix point 2 from this comment

About point 1 from this comment, I don't see how this is related to changes in this PR, if you can convince me then I'll absolutely be on board it's a new issue & new job

@Beamanator Beamanator self-requested a review October 20, 2021 20:53
@parasharrajat
Copy link
Member Author

parasharrajat commented Oct 21, 2021

Well. @Beamanator There are a few things that you are missing.

  1. [HOLD for payment 2021-12-06] The Android hardware back button does not minimise the app when pressed on the LHN/home screen #4211 => Last priced at $1000 [HOLD for payment 2021-12-06] The Android hardware back button does not minimise the app when pressed on the LHN/home screen #4211 (comment).
  2. mWeb - Refreshing the LHN page opens chat with recent user #5027 => Last Priced at $1000.

But I am still investigating the 2. I am looking at the code to see if this could a bug with our configuration so I will complete the repro to compare.

For 1, I believe it's related as it was not happening earlier and only after these changes. I have checked the changes and the lib author has changes regarding drawer history which are causing our logic to fail.

const screenRoute = {type: 'route', name: screenName};
const history = [...(state.history || [])].map(() => screenRoute);
history.push(screenRoute);
return CommonActions.reset({
...state,
routes: [{
name: screenName,
params,
}],
history,
});
};
}

Let me debug it further.

@parasharrajat
Copy link
Member Author

parasharrajat commented Oct 21, 2021

If you resize the page so the whole page is the report body, then expand so you should see the LHN again, the LHN disappears.

@Beamanator I just fixed point 2. testing in Native Devices.

Working on an easy one now 1.

@parasharrajat
Copy link
Member Author

parasharrajat commented Oct 21, 2021

@Beamanator You would be happy to know. I have fixed both issues and We are ready to light this up.

We have to click twice on the LHN to go to any chat.

Analysis

I looked at the code for the drawer router and come to know that it usages history to determine the Drawer Status. But when we are resetting the state, we are not sending any history for drawer status. Thus it takes the Default status.
So on the first click, the report loads but the drawer is not closed.
On Second, it just takes to the report screen via closing the drawer.

@parasharrajat
Copy link
Member Author

Updated.

Copy link
Contributor

@marcaaron marcaaron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I know this has been a long PR, but these changes seem to have caused a not so great regression with navigating to a report

  1. Navigate to a report
  2. Press back button in header
  3. Search for a user
  4. Select chat
  5. Land on LHN instead of chat 💥

Comment on lines 11 to 13
// Drawer's implementaion is buggy. Modern implementaion does not work on mobile web and legacy breaks the layout on Desktop while resizing.
// For some reason, drawer never closes when opening the Drawer screen on mobile web.
// So we will switch between implementations based on the device width.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Drawer's implementaion is buggy. Modern implementaion does not work on mobile web and legacy breaks the layout on Desktop while resizing.
// For some reason, drawer never closes when opening the Drawer screen on mobile web.
// So we will switch between implementations based on the device width.
// On mobile web, the non legacy version of the DrawerNavigator breaks the layout on Desktop while resizing
// and the drawer gets stuck in an open state when navigating

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any issue we are tracking for this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. I will create one.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No yet, I will create one in our repo.

"babel-plugin-transform-remove-console": "^6.9.4",
"babel-polyfill": "^6.26.0",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious, what needed babel-polyfill?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I followed https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/web-support. I don't know the consequences of removing this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I followed https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/web-support. I don't know the consequences of removing this.

@parasharrajat
Copy link
Member Author

I kind of know what is causing this. I will look at it asap.

@parasharrajat
Copy link
Member Author

Updated. Ready for review.

@parasharrajat
Copy link
Member Author

cc: @marcaaron @Beamanator

marcaaron
marcaaron previously approved these changes Oct 30, 2021
Copy link
Contributor

@marcaaron marcaaron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice working good now thanks!

@marcaaron
Copy link
Contributor

All yours @Beamanator.

Copy link
Contributor

@Beamanator Beamanator left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall the changes look great, the back button on android is working great 👍 and resizing the window in desktop & web have no regressions 👍

The only 🤷 things are:

  1. refreshing on web / desktop when you have a chat open, takes you back to the LHN
    • As mentioned in earlier comments, you're planning to fix this in another PR, right?
  2. the comment below
    • If you disagree with me / I'm confused, no change is necessary :D

src/libs/Navigation/AppNavigator/DrawerNavigator/index.js Outdated Show resolved Hide resolved
@parasharrajat
Copy link
Member Author

parasharrajat commented Oct 30, 2021

refreshing on web / desktop when you have a chat open, takes you back to the LHN
As mentioned in earlier comments, you're planning to fix this in another PR, right?

Unfortunately, we won't be solving the #5027 (comment) anymore. But yeah It would have been solved separately.

@parasharrajat
Copy link
Member Author

parasharrajat commented Nov 1, 2021

@Beamanator Comment updated. Ready for merge.

@Beamanator Beamanator self-requested a review November 1, 2021 14:18
Copy link
Contributor

@Beamanator Beamanator left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for all of this 💪

@Beamanator Beamanator merged commit f2fb01a into Expensify:main Nov 1, 2021
@OSBotify
Copy link
Contributor

OSBotify commented Nov 1, 2021

🚀 Deployed to staging by @Beamanator in version: 1.1.11-6 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 failure ❌
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

Comment on lines -95 to +96
"react-native-reanimated": "^2.3.0-alpha.1",
"react-native-reanimated": "^2.3.0-beta.3",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @Beamanator @parasharrajat this change here seems to have broken the Attachment Picker for me on iOS: https://expensify.slack.com/archives/C01GTK53T8Q/p1635874753343600

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, @kidroca this is PR is reverted now. Thanks for notifying me.

@OSBotify
Copy link
Contributor

OSBotify commented Nov 2, 2021

🚀 Deployed to production by @yuwenmemon in version: 1.1.12-3 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

@parasharrajat parasharrajat mentioned this pull request Nov 17, 2021
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants