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 cursor styling for NewDatePicker & BaseTextInput #17783

Conversation

daraksha-dk
Copy link
Contributor

@daraksha-dk daraksha-dk commented Apr 21, 2023

Details

#16513 (comment)
#16513 (comment)
#16513 (comment)
#16513 (comment)

We decided to only change the cursor styling to default value for this input

Fixed Issues

$ #16513
PROPOSAL: #16513 (comment)

Tests

  1. Go to www.staging.new.expensify.com
  2. Go to Settings > Profile > Personal details
  3. Go to Date of birth of an account where the DOB has not yet been entered
  4. Hover over the Date field and verify that default cursor is being shown
  5. Click on the Textbox and Date Icon and verify that input doesn't flicker
  • Verify that no errors appear in the JS console

Offline tests

QA Steps

  1. Go to www.staging.new.expensify.com
  2. Go to Settings > Profile > Personal details
  3. Go to Date of birth of an account where the DOB has not yet been entered
  4. Hover over the Date field and verify that default cursor is being shown
  5. Click on the Textbox and Date Icon and verify that input doesn't flicker
  • 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
      • If any non-english text was added/modified, I verified the translation was requested/reviewed in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:
    • 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 grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is 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 code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • 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.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I have checked off every checkbox in the PR author checklist, including those that don't apply to this PR.

Screenshots/Videos

Web
Screen.Recording.2023-04-22.at.2.07.58.AM.mov
Mobile Web - Chrome
Screen.Recording.2023-04-22.at.1.55.39.AM.mov
Mobile Web - Safari
Screen.Recording.2023-04-22.at.1.47.52.AM.mov
Desktop
Screen.Recording.2023-04-22.at.2.01.36.AM.mov
iOS
Screen.Recording.2023-04-22.at.1.57.33.AM.mov
Android
Screen.Recording.2023-04-22.at.2.02.23.AM.mov

@MelvinBot
Copy link

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

@daraksha-dk daraksha-dk marked this pull request as ready for review April 21, 2023 12:23
@daraksha-dk daraksha-dk requested a review from a team as a code owner April 21, 2023 12:23
@melvin-bot melvin-bot bot requested review from mountiny and Santhosh-Sellavel and removed request for a team April 21, 2023 12:23
@MelvinBot
Copy link

@mountiny @Santhosh-Sellavel 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]

Copy link
Contributor

@Prince-Mendiratta Prince-Mendiratta left a comment

Choose a reason for hiding this comment

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

Overall looks good, love the idea on using the editable prop instead of creating a new prop!

src/components/NewDatePicker/index.js Show resolved Hide resolved
src/components/NewDatePicker/index.js Outdated Show resolved Hide resolved
@Prince-Mendiratta
Copy link
Contributor

With this PR, since we are proceeding with the assumption that the NewDatePicker will always be open, we can get rid of the Animated View that is used when the picker is opened manually by user. This is because when the user navigates to the DOB page, the is animation is fast enough such that the picker already shown and the user is not able to actually see the animation.

Thoughts @daraksha-dk @Santhosh-Sellavel @mountiny?

The changes would involve:

  • Getting rid of the showPicker method.
  • Getting rid of the opacity.
  • Getting rid of the componentDidMount method.
  • Getting rid of the autoFocus prop from DateOfBirthPage.
  • Converting Animated.View to View.
  • Removing the Animated import from RN.

@daraksha-dk
Copy link
Contributor Author

I don't have a strong opinion on that, but it may not be relevant to this PR.

@Santhosh-Sellavel
Copy link
Collaborator

Santhosh-Sellavel commented Apr 21, 2023

With this PR, since we are proceeding with the assumption that the NewDatePicker will always be open, we can get rid of the Animated View that is used when the picker is opened manually by user. This is because when the user navigates to the DOB page, the is animation is fast enough such that the picker already shown and the user is not able to actually see the animation.

Thoughts @daraksha-dk @Santhosh-Sellavel @mountiny?

The changes would involve:

  • Getting rid of the showPicker method.
  • Getting rid of the opacity.
  • Getting rid of the componentDidMount method.
  • Getting rid of the autoFocus prop from DateOfBirthPage.
  • Converting Animated.View to View.
  • Removing the Animated import from RN.

@daraksha-dk This is part of @Prince-Mendiratta's proposal refactor which we agreed on, so can you make the changes?

@daraksha-dk
Copy link
Contributor Author

@Santhosh-Sellavel sure, I can do that. But I'd like to clarify that these changes were not a part of @Prince-Mendiratta's proposal.

@Prince-Mendiratta can confirm.

@Prince-Mendiratta
Copy link
Contributor

Prince-Mendiratta commented Apr 21, 2023 via email

@Santhosh-Sellavel
Copy link
Collaborator

Santhosh-Sellavel commented Apr 21, 2023

Oops I misread it then, I think this should be removed as well there is no point in keeping them.

@daraksha-dk
Copy link
Contributor Author

Got it, thanks! Updating the PR now.

Copy link
Contributor

@Prince-Mendiratta Prince-Mendiratta left a comment

Choose a reason for hiding this comment

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

LGTM, tests well too!

@Santhosh-Sellavel
Copy link
Collaborator

@Prince-Mendiratta Can you complete the reviewer checklist too as you are testing this one thanks!

@Prince-Mendiratta
Copy link
Contributor

Prince-Mendiratta commented Apr 21, 2023 via email

@daraksha-dk
Copy link
Contributor Author

daraksha-dk commented Apr 21, 2023

Updated all the videos in the OP after the latest changes!

@Prince-Mendiratta
Copy link
Contributor

Prince-Mendiratta commented Apr 21, 2023

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 grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is 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 code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • 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.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Web
web.mp4
Mobile Web - Chrome
android-mWeb.mp4
Mobile Web - Safari
iOS-mWeb.mp4
Desktop
desktop.mp4
iOS
iOS.mp4
Android
android.mp4

@Prince-Mendiratta
Copy link
Contributor

@daraksha-dk can you please add the test in the OP to click on the Icon & Textbox and ensure that it does flicker? Thanks.

@daraksha-dk
Copy link
Contributor Author

@Prince-Mendiratta OP updated!

label={this.props.label}
value={this.props.value || ''}
defaultValue={this.defaultValue}
placeholder={this.props.placeholder || this.props.translate('common.dateFormat')}
errorText={this.props.errorText}
containerStyles={this.props.containerStyles}
textInputContainerStyles={this.state.isPickerVisible ? [styles.borderColorFocus] : []}
textInputContainerStyles={[styles.borderColorFocus]}
inputStyle={[styles.pointerEventsNone]}
Copy link
Contributor

Choose a reason for hiding this comment

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

@daraksha-dk Adding this makes the label "Date" selectable when double clicking just above the input date, which is not happening on staging. I don't think we'd like to see that, double clicking anywhere should only select the text and not the label.

2023-04-22.03-15-21.mp4

Copy link
Collaborator

Choose a reason for hiding this comment

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

Not a problem

@Prince-Mendiratta
Copy link
Contributor

Also, double clicking on the icon selects the Month text but that is reproducible on staging as well. Should we do anything for this or let it remain @Santhosh-Sellavel @mountiny?

@Santhosh-Sellavel
Copy link
Collaborator

Not a problem here.

Copy link
Contributor

@Prince-Mendiratta Prince-Mendiratta left a comment

Choose a reason for hiding this comment

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

LGTM! All yours @Santhosh-Sellavel @mountiny !

Got the be a C+ for the day experience today haha

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.

I love this refactoring and the collaboration here, really great job @Prince-Mendiratta and @Santhosh-Sellavel helping @Prince-Mendiratta to do his C+ trial :D

I hope to see you applying at some point!

@mountiny mountiny merged commit 41e8810 into Expensify:main Apr 21, 2023
@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.

@Prince-Mendiratta
Copy link
Contributor

Thank you @mountiny @Santhosh-Sellavel, loved the trail! I do plan on applying for the C+ program once I'm done with my semester exams soon and eventually for the job as well so we can actually meet up in SA! :D

@OSBotify
Copy link
Contributor

🚀 Deployed to staging by https://github.com/mountiny in version: 1.3.5-0 🚀

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

@OSBotify
Copy link
Contributor

🚀 Deployed to production by https://github.com/jasperhuangg in version: 1.3.5-6 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 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.

6 participants