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: Modal freezing issue on Payments page #8173

Merged
merged 3 commits into from
Mar 20, 2022

Conversation

parasharrajat
Copy link
Member

@parasharrajat parasharrajat commented Mar 15, 2022

Details

Fixed Issues

$ #7768

Tests

  1. Tried all combinations on the payments page that trigger a modal on each platform.
  • Verify that no errors appear in the JS console

PR Review Checklist

Contributor (PR Author) Checklist

  • I verified the PR has a small number of commits behind main
  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I clearly indicated the environment tests should be run in (Staging vs Production)
  • I wrote testing steps that cover success & fail scenarios (if applicable)
  • I included screenshots or videos for tests on all platforms
  • I ran the tests & veryfy they passed on:
    • iOS / native
    • Android / native
    • iOS / Safari
    • Android / Chrome
    • MacOS / Chrome
    • MacOS / Desktop
  • I verified there are no console errors related to changes in this PR
  • I followed proper code patterns (see Reviewing the code)
    • I added comments when the code was not self explanatory
    • I put all copy / text shown in the product in all src/languages/* files (if applicable)
    • I followed proper naming convention for platform-specific files (if applicable)
    • I followed style guidelines (in Styling.md) for all style edits I made
    • I followed the JSDocs style guidelines (in STYLE.md)
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • I corroborated the UI performance was not affected (the performance is the same than main branch)
  • If I created a new component I verified that a similar component doesn't exist in the codebase

PR Reviewer Checklist

  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover failure scenarios (if applicable, i.e. verify an input displays the correct error message if the entered data is not correct)
    • I verified steps cover offline scenarios (if applicable, i.e. verify the default avatar icon is displayed if app is offline)
  • I checked that screenshots or videos are included for tests on all platforms
  • I verified tests pass on all platforms & I tested again on:
    • iOS / native
    • Android / native
    • iOS / Safari
    • Android / Chrome
    • MacOS / Chrome
    • MacOS / Desktop
  • I verified there are no console errors related to changes in this PR
  • I verified proper code patterns were followed (see Reviewing the code)
    • I verified comments were added when the code was not self explanatory
    • I verified any copy / text shown in the product was added in all src/languages/* files (if applicable)
    • I verified proper naming convention for platform-specific files was followed (if applicable)
    • I verified style guidelines were followed
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • I verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components are not impacted by changes in this PR (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • Has the displayName property if it’s a Functional Component
    • Has Storybook stories (optional)
    • Has Unit tests (optional)
  • If a new CSS style is added I verified that:
    • A similar style doesn’t already exist
    • The style can’t be created with a StyleUtils function
      (i.e. StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)

QA Steps

  1. Open the Payment Page from Settings => Payments.
  2. Click/Tap on any existing payment method Except Paypal.
  3. A new menu modal should open.
  4. Press the Back hardware button on Native or Click outside the menu area. Modal should close and App should not freeze.
  5. Repeat 2 and 3. Now select Make default payment Method.
  6. Menu modal should close and password modal should open.
  7. Follow 4.
  8. Repeat 2 and 3, New select Delete option.
  9. Menu modal should close and delete confirmation should show up.
  10. Follow 4.

Run these steps on staging on all platforms. Note: pressing the Back hardware button on the Android web is not the same as pressing the back button Android native app. To close the modal on Android Web click outside the area.

  • Verify that no errors appear in the JS console

Screenshots

Web | Desktop

image

Mobile Web

image

iOS

screen-2022-03-16_22.05.55.mp4

Android

Screenshot_2022-03-16_19-35-32

@parasharrajat parasharrajat marked this pull request as ready for review March 16, 2022 16:37
@parasharrajat parasharrajat requested a review from a team as a code owner March 16, 2022 16:37
@MelvinBot MelvinBot requested review from mountiny and removed request for a team March 16, 2022 16:58
Copy link
Contributor

@mountiny mountiny left a comment

Choose a reason for hiding this comment

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

@parasharrajat Changes look good to me, but I am just wondering since this is a workaround for the case of more than one modal in RN, should we document this approach a bit more thoroughly at some readme? Also maybe some comments for the Interaction Manager would not hurt so it is a bit clearer what is going on just by reading the codebase.

Essentially, I believe we would run into this bug in future as we will add features and functionality, therefore leaving some instructions for other contributors would be handy. What do you think?

@parasharrajat
Copy link
Member Author

parasharrajat commented Mar 16, 2022

Sure. Apart from this LayoutAnimation warns us for running it before another animation is done which is not hurting the app in any way. But as that is used as a workaround to fix the freeze we will have to stick with that warning. Do you think, I should ignore that warning from LogBox so that it does not popup.

Please let me know where do you want me to document it. I will add it.

@mountiny
Copy link
Contributor

@parasharrajat Alright, I thought there was a markdown file with the React Navigation steps (not sure why 😄 ) but I cant find any so I think it would be fine if you could just write a bit more detailed comment in this file to explain it. Surely if a similar problem comes again, you or I will be able to point to this file as an example of what to do!

@mountiny mountiny self-requested a review March 18, 2022 14:22
@@ -364,7 +377,7 @@ class BasePaymentsPage extends React.Component {
isDangerousAction
/>
<ConfirmPopover
contentStyles={[!this.props.isSmallScreenWidth ? styles.sidebarPopover : '']}
contentStyles={!this.props.isSmallScreenWidth ? [styles.sidebarPopover] : undefined}
Copy link
Contributor

Choose a reason for hiding this comment

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

Why change to undefined instead of [""] which was there previously? Just curious.

Otherwise just missing the comments and we should be good to go.

Copy link
Member Author

@parasharrajat parasharrajat Mar 18, 2022

Choose a reason for hiding this comment

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

Setting it to undefined is like resetting it. So it will automatically take dfaultProp value for this prop.

[""] is the wrong value for this prop. It expects it to be Array<Object>.

Copy link
Contributor

Choose a reason for hiding this comment

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

Gotcha! thanks for the explanation.

@parasharrajat
Copy link
Member Author

I have added the comments. Please let me know if you see some improvements.

Copy link
Contributor

@mountiny mountiny left a comment

Choose a reason for hiding this comment

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

Great! Thank you very much, all LGTM!

@mountiny mountiny merged commit 15ae27b into Expensify:main Mar 20, 2022
@OSBotify
Copy link
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@OSBotify
Copy link
Contributor

🚀 Deployed to staging by @mountiny in version: 1.1.46-0 🚀

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

@kbecciv
Copy link

kbecciv commented Mar 24, 2022

@parasharrajat @mountiny @fukawi2 We are still experience the open issue in IOS app #7869

HBWZ7385.1.MP4

@mountiny
Copy link
Contributor

@parasharrajat I could confirm on my account on the staging app that the first case of just opening the modal and closing it by clicking outside (iOS) worked well.

However, when I clicked make default, the modal closed, but the app froze. Unfortunately cannot provide any logs from that.

It is interesting though that it works for one case and not for the other.

@parasharrajat
Copy link
Member Author

Ok I will take a stab at it.

@timszot
Copy link
Contributor

timszot commented Mar 29, 2022

@parasharrajat @mountiny any updates on this? I don't think we need to hold the deploy based that this is partially fixed now and the original problem is on production. Does that sound right to you two?

@mountiny
Copy link
Contributor

@timszot definitely sounds right to me!

@parasharrajat
Copy link
Member Author

Yup Sounds good.

@OSBotify
Copy link
Contributor

🚀 Deployed to production by @timszot in version: 1.1.46-3 🚀

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

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.

5 participants