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 android keyboard issue #13106

Merged
merged 6 commits into from
Nov 29, 2022
Merged

fix android keyboard issue #13106

merged 6 commits into from
Nov 29, 2022

Conversation

0xmiros
Copy link
Contributor

@0xmiros 0xmiros commented Nov 28, 2022

Details

remove KeyboardAvoidingView in android

Fixed Issues

$ #11087
$ #13111
PROPOSAL: #11087 (comment)

Tests

Scenario 1:

  1. Login with any account
  2. Go to Setting -> Profile > Add phone number
  3. (optional) Click on Phone number field if not auto focused (auto-focus should always happen on native platforms)
  4. Click on Password field
  5. Verify that Send validation button floats above keyboard and is not hidden

Scenario 2:

  1. Login with any account
  2. Go to any chat room
  3. Click on composer and start typing
  4. Verify that composer is not hidden by keyboard
  • Verify that no errors appear in the JS console

Offline tests

Scenario 1:

  1. Login with any account
  2. Disable network
  3. Go to Setting -> Profile > Add phone number
  4. (optional) Click on Phone number field if not auto focused (auto-focus should always happen on native platforms)
  5. Click on Password field
  6. Verify that Send validation button floats above keyboard and is not hidden

Scenario 2:

  1. Login with any account
  2. Go to any chat room
  3. Disable network
  4. Click on composer and start typing
  5. Verify that composer is not hidden by keyboard

QA Steps

Scenario 1:

  1. Login with any account
  2. Go to Setting -> Profile > Add phone number
  3. (optional) Click on Phone number field if not auto focused (auto-focus should always happen on native platforms)
  4. Click on Password field
  5. Verify that Send validation button floats above keyboard and is not hidden

Scenario 2:

  1. Login with any account
  2. Go to any chat room
  3. Click on composer and start typing
  4. Verify that composer is not hidden by keyboard
  • 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:
    • 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 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 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.
  • I have checked off every checkbox in the PR author checklist, including those that don't apply to this PR.

PR Reviewer Checklist

The reviewer will copy/paste it into a new comment and complete it after the author checklist is completed

  • 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 expected offline behavior are in the Offline steps 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 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 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:
    • iOS / native
    • Android / native
    • iOS / Safari
    • Android / Chrome
    • MacOS / Chrome
    • 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 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 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
  • 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 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.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Web web
Mobile Web - Chrome

mchrome

Mobile Web - Safari
msafari.mp4
Desktop
desktop.mov
iOS
ios.mp4
Android
android.mp4

@0xmiros 0xmiros requested a review from a team as a code owner November 28, 2022 21:58
@melvin-bot melvin-bot bot requested review from pecanoro and Santhosh-Sellavel and removed request for a team November 28, 2022 21:58
@melvin-bot
Copy link

melvin-bot bot commented Nov 28, 2022

@pecanoro @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]

@roryabraham
Copy link
Contributor

roryabraham commented Nov 29, 2022

@tgolen didn't we get rid of our own KeyboardAvoidingView in another recent PR?

Edit: I see there's more context on this PR in slack here

@github-actions
Copy link
Contributor

⚠️ ⚠️ Heads up! This pull request has the CP Staging label ⚠️ ⚠️
If you applied the CP Staging label before the PR was merged, the PR will be be immediately deployed to staging even if the open StagingDeployCash deploy checklist is locked.
However if you applied the CP Staging after the PR was merged it's possible it won't be CP'ed automatically. If you need it to be CP'ed to staging, tag a member of @Expensify/mobile-deployers to CP it manually, otherwise you can wait for it to go out with the next deploy.

@mountiny
Copy link
Contributor

Adding CP Staging label since this PR should fix a deploy blocker

@@ -0,0 +1,26 @@
/*
* This is a KeyboardAvoidingView only enabled for ios && disabled for all other platforms
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a KeyboardAvoidingView only enabled for ios && disabled for all other platforms

Could we make this a bit more readable (similar to this):

The KeyboardAvoidingView is only used on ios

Copy link
Contributor

@Julesssss Julesssss left a comment

Choose a reason for hiding this comment

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

These PR tests look good, next step is to test against all the listed PRs.

@0xmiros
Copy link
Contributor Author

0xmiros commented Nov 29, 2022

I suggest to link all fixing issues in PR description.
For now, I only linked $ #11087

Julesssss
Julesssss previously approved these changes Nov 29, 2022
Copy link
Contributor

@Julesssss Julesssss left a comment

Choose a reason for hiding this comment

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

I tested all the linked issues. With the exception of #10483 I can confirm this has resolved the problems. Great work here

@mountiny
Copy link
Contributor

@0xmiroslav you can link all the issues which are:

  • not linked as help Wanted - we need to make sure the proposal flow has been followed - unless issue is on HOLD
  • you add the testing and QA steps necessary to confirm those issues have been fixed

@@ -107,7 +107,7 @@ class AddSecondaryLoginPage extends Component {
onBackButtonPress={() => Navigation.navigate(ROUTES.SETTINGS_PROFILE)}
onCloseButtonPress={() => Navigation.dismissModal()}
/>
<ScrollView style={styles.flex1} contentContainerStyle={styles.p5}>
<ScrollView style={styles.flex1} contentContainerStyle={styles.p5} keyboardShouldPersistTaps="handled">
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this necessary?

Copy link
Contributor

Choose a reason for hiding this comment

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

+1 it would be nice to leave a comment for this

Copy link
Contributor

Choose a reason for hiding this comment

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

I believe I've seen this before when the intention is to allow someone to tap outside of an input so that the input will blur and the keyboard will dismiss. This was the case for the old Login form before I changed it in this PR: #12848

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is to prevent keyboard randomly hidden when switching focus on phone/password fields

Copy link
Contributor Author

Choose a reason for hiding this comment

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

comment will be added in new commit

Copy link
Contributor

@Julesssss Julesssss left a comment

Choose a reason for hiding this comment

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

Just to confirm what we're doing here, we're removing the android specific ScreenWrapper component which is now unnecessary?

@Julesssss
Copy link
Contributor

Julesssss commented Nov 29, 2022

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:
    • iOS / native
    • Android / native
    • iOS / Safari
    • Android / Chrome
    • MacOS / Chrome
    • 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 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 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 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.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Web Screenshot 2022-11-29 at 13 51 35
Mobile Web - Chrome Screenshot 2022-11-29 at 13 51 35
Mobile Web - Safari

// Due to cache, the site is in light mode

Simulator Screen Shot - iPhone 14 Pro - 2022-11-29 at 13 52 03

Desktop
Screenshot 2022-11-29 at 13 52 55
iOS
![Simulator Screen Shot - iPhone 14 Pro - 2022-11-29 at 13 30 10](https://user-images.githubusercontent.com/10736861/204548520-fba020e7-4a59-4b1e-b635-47fca721dbef.png)
Android
![AndroidPhoneNumber](https://user-images.githubusercontent.com/10736861/204548427-e517b7e7-32f8-48b3-9715-d2cdef96f881.png)

@Julesssss
Copy link
Contributor

Please review as this resolves a deploy blocker @pecanoro @luacmartins @Santhosh-Sellavel

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.

LGTM, testing on Android

@@ -107,7 +107,7 @@ class AddSecondaryLoginPage extends Component {
onBackButtonPress={() => Navigation.navigate(ROUTES.SETTINGS_PROFILE)}
onCloseButtonPress={() => Navigation.dismissModal()}
/>
<ScrollView style={styles.flex1} contentContainerStyle={styles.p5}>
<ScrollView style={styles.flex1} contentContainerStyle={styles.p5} keyboardShouldPersistTaps="handled">
Copy link
Contributor

Choose a reason for hiding this comment

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

+1 it would be nice to leave a comment for this

mountiny
mountiny previously approved these changes Nov 29, 2022
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.

Test 1

image

Chat report keyboard
image

The emoji picker also seems to work but I assume this is very android version specific

image

We can ask Applause to retest all of those on staging once deployed

@mountiny mountiny requested a review from tgolen November 29, 2022 14:40
@mountiny
Copy link
Contributor

@tgolen tagging you for a review as you expressed such desire in Slack

@Santhosh-Sellavel
Copy link
Collaborator

@0xmiroslav Please add test steps for this issue #13111 also.

@0xmiros
Copy link
Contributor Author

0xmiros commented Nov 29, 2022

@0xmiroslav Please add test steps for this issue #13111 also.

done

@Santhosh-Sellavel
Copy link
Collaborator

Santhosh-Sellavel commented Nov 29, 2022

All looks good tests well!

Issues noticed while testing

Failing for mWeb Safari

Verify that Send validation button floats above the keyboard and is not hidden

This is failing for mWeb - Safari - but this is not a blocker for this issue. ✅

Keyboard glitch on Android

Also found a weird glitch in the keyboard while opening & closing add phone number page on android . This is not introduced here

Screen.Recording.2022-11-30.at.1.27.05.AM.mov

Autofill email in add phone number screen

Email & password is auto-filled on Add phone number page. This is reported already by marc on slack ✅

What should we do about the keyboard glitch?
cc: @luacmartins @Julesssss @tgolen

Copy link
Collaborator

@Santhosh-Sellavel Santhosh-Sellavel left a comment

Choose a reason for hiding this comment

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

Looks good and tested well for me!

@luacmartins luacmartins dismissed tgolen’s stale review November 29, 2022 20:15

comments addressed

@luacmartins
Copy link
Contributor

@Santhosh-Sellavel has this keyboard glitch been reported anywhere? If not, let's report it and tackle it in a separate issue.

@luacmartins
Copy link
Contributor

I dismissed @tgolen review since we talked 1:1 and his only concern was omitting the KAV props, which we addressed. Gonna merge to continue with the deploy.

@luacmartins luacmartins merged commit d5a293d into Expensify:main Nov 29, 2022
OSBotify pushed a commit that referenced this pull request Nov 29, 2022
fix android keyboard issue

(cherry picked from commit d5a293d)
OSBotify added a commit that referenced this pull request Nov 29, 2022
@pecanoro
Copy link
Contributor

pecanoro commented Nov 29, 2022

@luacmartins You could have waited a few minutes for my final review though so at least I could get that contribution after reviewing the proposal and originally discussing this issue 😢

@OSBotify
Copy link
Contributor

🚀 Cherry-picked to staging by @luacmartins in version: 1.2.33-4 🚀

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

@Expensify/applauseleads please QA this PR and check it off on the deploy checklist if it passes.

@OSBotify
Copy link
Contributor

🚀 Deployed to production by @luacmartins in version: 1.2.33-7 🚀

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

@OSBotify
Copy link
Contributor

🚀 Deployed to production by @luacmartins in version: 1.2.33-7 🚀

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

@OSBotify
Copy link
Contributor

🚀 Cherry-picked to staging by https://github.com/AndrewGable in version: 1.3.28-2 🚀

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

@Expensify/applauseleads please QA this PR and check it off on the deploy checklist if it passes.

@OSBotify
Copy link
Contributor

🚀 Deployed to production by https://github.com/AndrewGable in version: 1.3.28-5 🚀

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.

9 participants