Skip to content

split digit cut off fix#9102

Merged
pecanoro merged 2 commits into
Expensify:mainfrom
mweb-split-digit-fix:main
Jun 8, 2022
Merged

split digit cut off fix#9102
pecanoro merged 2 commits into
Expensify:mainfrom
mweb-split-digit-fix:main

Conversation

@aneequeahmad

Copy link
Copy Markdown
Contributor

Details

  • When the cursor comes after coming back it already has the calculated width of text(also cursor width is 1px more causing the issue) from onlayout which is 1 px less than the actual width.
  • Adding + 1 in width isn't noticeable and fixes the issues

Fixed Issues

$ #8158

Tests

[] Verify that no errors appear in the JS console

  • Login to app on mWeb.
  • Press on + icon and click split bill and add amount like 888.
  • Press Next and on next screen press back button from header(top-left)
  • First digit will be shown as expected without cut off(Broken)

PR Review Checklist

Contributor (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 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 included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • iOS / native
    • Android / native
    • iOS / Safari
    • Android / Chrome
    • MacOS / Chrome
    • 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 was added in all src/languages/* files
    • I verified any copy / text that was added to the app is correct English and approved by marketing by tagging the marketing team 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
  • 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 */
    • Any functional components have the displayName property
    • 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
  • 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.

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 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 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 (if there’s a console error not related to the PR, report it or open an issue for it to be fixed)
  • 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 was added in all src/languages/* files
    • I verified any copy / text that was added to the app is correct English and approved by marketing by tagging the marketing team 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 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 */
    • Any functional components have the displayName property
    • 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 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.

QA Steps

  • Verify that no errors appear in the JS console
  • Login to app on mWeb.
  • Press on + icon and click split bill and add amount like 888.
  • Press Next and on next screen press back button from header(top-left)
  • First digit will be shown as expected without cut off(Broken)

Screenshots

cannot run app on my local machine as im getting error 403 by api's that's why cant upload screenshots unfortunately.

Web

Desktop

IOS

Android

Mweb

@aneequeahmad aneequeahmad requested a review from a team as a code owner May 20, 2022 05:07
@melvin-bot

melvin-bot Bot commented May 20, 2022

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!

@melvin-bot melvin-bot Bot requested review from pecanoro and rushatgabhane and removed request for a team May 20, 2022 05:07
@pecanoro

Copy link
Copy Markdown
Contributor

What do you mean by cannot run app on my local machine as im getting error 403 by api's that's why cant upload screenshots unfortunately.? You need to test your changes before we can approve the PR. Can you post in #expensify-open-source in Slack to see if someone has had this problem before and can help you?

@aneequeahmad

Copy link
Copy Markdown
Contributor Author

@pecanoro i have posted already on slack 2 times but couldn’t find any help. It looks like i have to buy a new machine to run the project.

Also i have tested these changes on all platforms when the app was running.

@rushatgabhane

rushatgabhane commented May 20, 2022

Copy link
Copy Markdown
Member

Here's the slack thread which @aneequeahmad was referring to - https://expensify.slack.com/archives/C01GTK53T8Q/p1652066886829219

I'll see what I can do to help on the thread.

@pecanoro

Copy link
Copy Markdown
Contributor

Ohh gotcha! Ok, that is tricky because I am not sure what's wrong either, I think there has been some movement on the thread, I am hoping tomorrow it gets resolved, otherwise not sure what's the best way to proceed, I will ask to the team.

@rushatgabhane

rushatgabhane commented May 27, 2022

Copy link
Copy Markdown
Member

Hmm, there isn't any movement on the thread.
To move things forward, I'll post screenshots over the weekend.

@aneequeahmad

Copy link
Copy Markdown
Contributor Author

@rushatgabhane Thats so nice of you 🙇‍♂️. I have setup the linux on VM but would require another day to get the project up and running. If you can post screenshots over the weekend that would be great. I’ll also be available over the weekend. Let’s get it done. Let me know if there are any changes required in the PR. Thanks

@aneequeahmad

Copy link
Copy Markdown
Contributor Author

@rushatgabhane also, what should i do to run the project on my macBook ? Should i re-install the the OS completely ? Maybe lower version of OS. It’s stoping me from the work :(

<Text
style={[...this.props.inputStyle, styles.hiddenElementOutsideOfWindow, styles.visibilityHidden]}
onLayout={e => this.setState({textInputWidth: e.nativeEvent.layout.width})}
onLayout={e => this.setState({textInputWidth: e.nativeEvent.layout.width + 1})}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@aneequeahmad we gotta bump the width to + 2. It worked better for me on cases like

  • back from currency selection
  • back from participant page

Also, we should def add a comment explaining why we are adding +2 to the width

Screen.Recording.2022-05-30.at.12.53.48.AM.mov

@rushatgabhane rushatgabhane May 29, 2022

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Here's the storybook preview of the input after a +2 width increase.
Not noticeble even when I pixel peep with web inspector 🔍

image

@rushatgabhane

Copy link
Copy Markdown
Member

Hey @aneequeahmad just a gentle nudge to address the comments

@aneequeahmad

Copy link
Copy Markdown
Contributor Author

@rushatgabhane Done, Thank you for pounting this out.

@aneequeahmad

Copy link
Copy Markdown
Contributor Author

@rushatgabhane I pushed 1 commit that was unsigned. Rebased it pushed again but still it's appearing.

@rushatgabhane rushatgabhane left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Rebased it pushed again but still it's appearing

@aneequeahmad this is one of the only situation you should force push to remove the unverified commit from remote.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please move the comment to top of onLayout, and link the issue for full context.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@rushatgabhane If i add comment on top of onLayout between style line break comment it throws eslint error that there shoule be no line break between style and onLayout if i remove line break it throws error that line break is needed.

Should i disable the eslint error ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ohh, in that case move it above the Text component.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
// Added +2 in width so that the first digit of split amount do not cut off on mWeb.
// Add +2 to width so that the first digit of amount do not cut off on mWeb - https://github.com/Expensify/App/issues/8158

@rushatgabhane rushatgabhane left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@aneequeahmad

  1. You need to remove the unverified commit and force push.
  2. Fix lint error

@aneequeahmad

Copy link
Copy Markdown
Contributor Author

@rushatgabhane did force push but seems like unsigned commit wasn't removed

@rushatgabhane

rushatgabhane commented Jun 6, 2022

Copy link
Copy Markdown
Member

@aneequeahmad try this

  1. git reset --hard unverifiedCommitHash~1
  2. git push --force

@aneequeahmad aneequeahmad force-pushed the main branch 2 times, most recently from 6ed007c to 8a46bf9 Compare June 6, 2022 10:55
@aneequeahmad

Copy link
Copy Markdown
Contributor Author

@rushatgabhane unverified commit is not removed i think i should reset hard to one commit before unverfied commit and force push ? or should i open a new PR ?

@aneequeahmad

Copy link
Copy Markdown
Contributor Author

@rushatgabhane Unverified commit removed and feedback changes applied. Thanks for guiding

@rushatgabhane rushatgabhane left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@pecanoro tests well and LGTM! 🎉
I've attached screenshots below.

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 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 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 (if there’s a console error not related to the PR, report it or open an issue for it to be fixed)
  • 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 was added in all src/languages/* files
    • I verified any copy / text that was added to the app is correct English and approved by marketing by tagging the marketing team 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 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 */
    • Any functional components have the displayName property
    • 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 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.

@rushatgabhane

rushatgabhane commented Jun 7, 2022

Copy link
Copy Markdown
Member

mWeb - iOS

Screen.Recording.2022-06-08.at.12.46.41.AM.mov

mWeb - Android

screen-20220608-005544.mp4

iOS

Screen.Recording.2022-06-08.at.12.45.43.AM.mov

Android

screen-20220608-010451.mp4

Web

Screen.Recording.2022-06-08.at.12.49.26.AM.mov

Desktop

Screen.Recording.2022-06-08.at.12.56.13.AM.mov

This Text component is intentionally positioned out of the screen.
*/}
{this.props.autoGrow && (

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.

Suggested change

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@pecanoro If i remove this line break lint throws error a line break is needed before 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.

Really? What an odd place to add the line break lol Anyways, if it pleases the linter, all good.

@pecanoro pecanoro merged commit 0896886 into Expensify:main Jun 8, 2022
@OSBotify

OSBotify commented Jun 8, 2022

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.

@OSBotify

OSBotify commented Jun 9, 2022

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by @pecanoro in version: 1.1.75-0 🚀

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

@OSBotify

OSBotify commented Jun 9, 2022

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by @roryabraham in version: 1.1.75-1 🚀

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.

4 participants