Skip to content

fix/14084 Bank account : The bottom section of Personal Information blinks when opening and closing DatePicker - #14270

Merged
jasperhuangg merged 6 commits into
Expensify:mainfrom
tienifr:fix/14084-bank-account-the-bottom-section-of-personal-information-blinks-when-opening-and-closing-datepicker
Jan 14, 2023
Merged

jasperhuangg merged 6 commits into
Expensify:mainfrom
tienifr:fix/14084-bank-account-the-bottom-section-of-personal-information-blinks-when-opening-and-closing-datepicker

Conversation

@tienifr

@tienifr tienifr commented Jan 13, 2023

Copy link
Copy Markdown
Contributor

Details

The action Keyboard.dismiss() and this.setState({isPickerVisible: true}) are executed asynchronous. Besides, Ios will dismiss the keyboard when popover is opened and open again when it's closed.
This PR implement this logic: "If keyboard is opening => I'll dismiss keyboard and open popover in keyboardDidHide listener. Otherwise I just open popover".

Fixed Issues

$ #14084
PROPOSAL: #14084 (comment)

Tests

1, Login with any account
2, Open Settings => Workspace => Connect Bank Account => Connect Manually => Enter valid information.
3, Tap on any TextInput then tap on DatePicker, tap outside to dismiss DatePicker.
4a. For iOS verify that the bottom section of the page isn't blinking after Date Picker closes.
4b. For other platforms make sure the Date Picker is working fine.

  • Verify that no errors appear in the JS console

Offline tests

QA Steps

1, Login with any account
2, Open Settings => Workspace => Connect Bank Account => Connect Manually => Enter valid information.
3, Tap on any TextInput then tap on DatePicker, tap outside to dismiss DatePicker.
4a. For iOS verify that the bottom section of the page isn't blinking after Date Picker closes.
4b. For other platforms make sure the Date Picker is working fine.

  • Verify that no errors appear in the JS console

PR Author Checklist

  • 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 added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android / native
    • Android / Chrome
    • iOS / native
    • iOS / Safari
    • MacOS / Chrome / Safari
    • MacOS / Desktop
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is correct English and approved by marketing by adding the Waiting for Copy label for a copy review on the original GH to get the correct copy.
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • 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 verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • I have checked off every checkbox in the PR author checklist, including those that don't apply to this PR.

Screenshots/Videos

Web
Mobile Web - Chrome
mweb_chrome.mp4
Mobile Web - Safari
mweb_safari.mp4
Desktop
iOS
ios.1.mp4
Android
android.mp4

@tienifr
tienifr requested a review from a team as a code owner January 13, 2023 07:04
@melvin-bot
melvin-bot Bot requested review from jasperhuangg and mollfpr and removed request for a team January 13, 2023 07:04
@melvin-bot

melvin-bot Bot commented Jan 13, 2023

Copy link
Copy Markdown

@jasperhuangg @mollfpr One of you needs to copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@melvin-bot

melvin-bot Bot commented Jan 13, 2023

Copy link
Copy Markdown

Hey! I see that you made changes to our Form component. Make sure to update the docs in FORMS.md accordingly. Cheers!

@tienifr

tienifr commented Jan 13, 2023

Copy link
Copy Markdown
Contributor Author

Hi @mollfpr @jasperhuangg , the PR has been created and all checks have passed. Please help me review my PR. Thank you!

Comment thread src/components/DatePicker/index.ios.js Outdated
Comment thread src/components/DatePicker/index.ios.js Outdated
Comment thread src/components/DatePicker/index.ios.js Outdated
@mollfpr

mollfpr commented Jan 13, 2023

Copy link
Copy Markdown
Contributor

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • 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 any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (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 included screenshots or videos for tests on all platforms
  • I verified tests pass on all platforms & I tested again on:
    • Android / native
    • Android / Chrome
    • iOS / native
    • iOS / Safari
    • MacOS / Chrome / Safari
    • MacOS / Desktop
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified proper code patterns were followed (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick).
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is correct English and approved by marketing by adding the Waiting for Copy label for a copy review on the original GH to get the correct copy.
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Web
14270.Web-Safari.mov
14270.Web-Chrome.mov
Mobile Web - Chrome
14270.mWeb-Chrome.mov
Mobile Web - Safari
14270.mWeb-Safari.mov
Desktop
14270.Desktop.mov
iOS
14270.iOS.mov
Android
14270.Android.mov

Comment thread src/components/DatePicker/index.ios.js Outdated
/**
* Ios will auto dismiss the keyboard when popover is opened and open again when it's closed
* We need the keyboardDidHide listener to make sure that the popover will only be opened after the keyboard is closed
*/

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We only use block comments for commenting function or add a description to propTypes and we can touch on the comment to more explicit about the issue is and how to resolve it.

We ensure open the popover is after the keyboard is hidden to avoid blinks at the bottom 
caused by the keyboard opening and closing after dismissing the popover. 
Issue: https://github.com/Expensify/App/issues/14084

@mollfpr mollfpr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Whoops, approving by accident.

@jasperhuangg jasperhuangg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

few minor changes, thanks for getting this up!

Comment thread src/components/DatePicker/index.ios.js Outdated
Comment thread src/components/DatePicker/index.ios.js Outdated
tienifr and others added 3 commits January 14, 2023 10:59
Co-authored-by: Jasper Huang <jasperhuangg@gmail.com>
Co-authored-by: Jasper Huang <jasperhuangg@gmail.com>
@tienifr

tienifr commented Jan 14, 2023

Copy link
Copy Markdown
Contributor Author

Hi @mollfpr @jasperhuangg, I just fixed the comments. Please help to review it again. Thanks

@mollfpr

mollfpr commented Jan 14, 2023

Copy link
Copy Markdown
Contributor

Thanks for the update @tienifr! Just a minor change on the test description, let's update the case since the noticeable fix is only on iOS.

4a. For iOS verify that the bottom section of the page isn't blinking after Date Picker closes.
4b. For other platforms make sure the Date Picker is working fine.

@tienifr

tienifr commented Jan 14, 2023

Copy link
Copy Markdown
Contributor Author

@mollfpr Done. Thanks for pointing out that

@mollfpr mollfpr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM 👍

A note to improve, we should always attach all the platform recordings even though in this issue we all change a specific platform file but it is worth always all the platforms rather than having a regression.

Also, your branch name is too long fix/14084-bank-account-the-bottom-section-of-personal-information-blinks-when-opening-and-closing-datepicker 🤣

All yours @jasperhuangg

@jasperhuangg
jasperhuangg merged commit 9973de7 into Expensify:main Jan 14, 2023
@OSBotify

Copy link
Copy Markdown
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.

@github-actions

Copy link
Copy Markdown
Contributor

Performance Comparison Report 📊

Significant Changes To Duration

There are no entries

Meaningless Changes To Duration

Show entries
Name Duration
App start TTI 676.583 ms → 684.192 ms (+7.609 ms, +1.1%)
App start regularAppStart 0.020 ms → 0.020 ms (+0.001 ms, +3.2%)
App start nativeLaunch 20.333 ms → 19.552 ms (-0.782 ms, -3.8%)
Open Search Page TTI 598.528 ms → 595.191 ms (-3.337 ms, -0.6%)
App start runJsBundle 195.281 ms → 191.125 ms (-4.156 ms, -2.1%)
Show details
Name Duration
App start TTI Baseline
Mean: 676.583 ms
Stdev: 38.122 ms (5.6%)
Runs: 617.3334590010345 623.1332830004394 626.4440580010414 629.0065709985793 630.1175910010934 630.2823820002377 630.8672950007021 632.928748998791 646.7401130013168 650.1869929991663 660.2544930018485 662.5555129982531 664.7834339998662 669.2836120016873 677.2505940012634 677.3879720009863 680.3578470014036 681.8178620003164 682.5093740001321 686.773003000766 690.4654430001974 695.1310500018299 696.6118000000715 701.3653240017593 703.503290001303 708.8229160010815 709.955979000777 712.6385410018265 722.7040080018342 728.3363710008562 760.463530998677 760.6377060003579

Current
Mean: 684.192 ms
Stdev: 32.590 ms (4.8%)
Runs: 624.7184929996729 642.048980999738 645.8107419982553 649.122715998441 649.4906900003552 649.5827369987965 658.5284180007875 660.2251980006695 662.1689170002937 663.8480090014637 664.2852829992771 667.0783490017056 667.3006770014763 667.3965229988098 672.2436049990356 678.9340669997036 686.9975840002298 688.550214998424 688.8193860016763 690.8736569993198 696.6813080012798 699.36275799945 705.0242480002344 715.9107909984887 717.1767870001495 719.5286680012941 720.8937009982765 721.546682998538 727.1038729995489 742.8566370010376 765.8415130004287
App start regularAppStart Baseline
Mean: 0.020 ms
Stdev: 0.001 ms (6.3%)
Runs: 0.016927000135183334 0.017984997481107712 0.018187999725341797 0.018473003059625626 0.018635999411344528 0.0186769999563694 0.0186769999563694 0.018881000578403473 0.01892099902033806 0.01908399909734726 0.01908399909734726 0.01912499964237213 0.019164998084306717 0.019450001418590546 0.01949099823832512 0.019693996757268906 0.019694000482559204 0.019694000482559204 0.019979000091552734 0.020061001181602478 0.02046699821949005 0.020548000931739807 0.020671002566814423 0.020955000072717667 0.02099599689245224 0.02103700116276741 0.02115899696946144 0.0215659998357296 0.022095002233982086 0.022501997649669647

Current
Mean: 0.020 ms
Stdev: 0.002 ms (8.5%)
Runs: 0.01757800206542015 0.018473997712135315 0.0186769999563694 0.018717002123594284 0.01879899948835373 0.018879998475313187 0.01896199956536293 0.01936899870634079 0.01948999986052513 0.019491001963615417 0.019531000405550003 0.01953199878334999 0.019571997225284576 0.01965400204062462 0.019977997988462448 0.020183000713586807 0.020305000245571136 0.02075200155377388 0.020955000072717667 0.02103700116276741 0.021078001707792282 0.021361999213695526 0.021849997341632843 0.0220940001308918 0.02221599966287613 0.02254199981689453 0.02319299802184105 0.025919999927282333
App start nativeLaunch Baseline
Mean: 20.333 ms
Stdev: 2.196 ms (10.8%)
Runs: 18 18 18 18 18 18 18 19 19 19 19 19 19 19 20 20 20 20 21 21 21 22 22 22 22 22 23 23 26 26

Current
Mean: 19.552 ms
Stdev: 1.476 ms (7.5%)
Runs: 17 18 18 18 18 18 18 19 19 19 19 19 19 19 19 20 20 20 20 20 20 20 20 20 21 21 21 23 24
Open Search Page TTI Baseline
Mean: 598.528 ms
Stdev: 22.287 ms (3.7%)
Runs: 568.327961999923 569.6085209995508 571.6940919980407 572.9715990014374 574.4267579987645 575.8141689971089 576.2099609971046 577.7433679997921 578.7135419994593 581.9479979984462 582.2402339987457 587.0065919980407 589.8850100003183 595.126017998904 595.228352997452 598.9680590033531 599.2730710022151 600.0141599997878 600.7961429990828 600.812663000077 602.5662030018866 602.8878180012107 605.0244560018182 611.651245996356 613.9549160003662 614.1141360029578 618.0970060005784 625.7482909969985 627.5681969970465 630.0501710027456 644.6456300020218 659.7860519997776

Current
Mean: 595.191 ms
Stdev: 20.811 ms (3.5%)
Runs: 558.1926679983735 568.5433360002935 569.8202309980989 570.9681399986148 575.1435549966991 575.4310710020363 578.1540120020509 578.6578780002892 579.7915040031075 580.7742100022733 581.850790001452 584.2213549986482 585.2916259989142 586.3252360001206 588.1063640005887 589.1029059998691 589.4749349988997 590.5871590003371 599.1297609992325 600.9942630007863 602.6805830001831 603.1503910012543 603.5440270006657 606.499634001404 607.5018320009112 617.7600100003183 620.8252360001206 623.7874759994447 626.9618330001831 629.2764080017805 636.2783209979534 637.2798670008779
App start runJsBundle Baseline
Mean: 195.281 ms
Stdev: 23.653 ms (12.1%)
Runs: 156 162 163 164 167 167 170 172 173 176 177 182 183 193 193 200 201 202 205 206 207 207 210 212 213 215 217 224 226 230 234 242

Current
Mean: 191.125 ms
Stdev: 21.624 ms (11.3%)
Runs: 159 161 164 166 170 174 175 175 175 176 178 179 183 183 185 185 186 187 191 193 197 197 204 205 208 208 209 213 222 225 228 255

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by @jasperhuangg in version: 1.2.55-0 🚀

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

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by @AndrewGable in version: 1.2.55-0 🚀

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

@esh-g

esh-g commented Jan 19, 2023

Copy link
Copy Markdown
Contributor

Regression !!!!

I caught a regression from this PR: https://expensify.slack.com/archives/C049HHMV9SM/p1674144058692939
APP CRASHES on clicking RESET in date picker.

Solution

diff --git a/src/components/DatePicker/index.ios.js b/src/components/DatePicker/index.ios.js
index 6f37202cf..960fa798c 100644
--- a/src/components/DatePicker/index.ios.js
+++ b/src/components/DatePicker/index.ios.js
@@ -41,6 +41,7 @@ class DatePicker extends React.Component {
     showPicker(event) {
         // Opens the popover only after the keyboard is hidden to avoid a "blinking" effect where the keyboard was on iOS
         // See https://github.com/Expensify/App/issues/14084 for more context
+        this.initialValue = this.state.selectedDate;
         if (!this.props.isKeyboardShown) {
             this.setState({isPickerVisible: true});
             return;
@@ -50,7 +51,6 @@ class DatePicker extends React.Component {
             listener.remove();
         });
         Keyboard.dismiss();
-        this.initialValue = this.state.selectedDate;
         event.preventDefault();
     }
 

May I be added as a contributor to this issue/PR?

@mollfpr

mollfpr commented Jan 20, 2023

Copy link
Copy Markdown
Contributor

Thanks @esh-g! Please, comment on the issue #14417

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