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

[HOLD for payment 2024-08-29] iOS-chat-Composer is hidden behind keyboard after copying a message on iOS 15 #47679

Closed
1 of 6 tasks
IuliiaHerets opened this issue Aug 20, 2024 · 12 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Engineering Weekly KSv2

Comments

@IuliiaHerets
Copy link

IuliiaHerets commented Aug 20, 2024

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: v9.0.22-5
Reproducible in staging?: Y
Reproducible in production?: N
If this was caught during regression testing, add the test name, ID and link from TestRail: https://expensify.testrail.io/index.php?/tests/view/4873332
Issue reported by: Applause Internal Team

Action Performed:

  1. Launch New Expensify app
  2. Go to conversation with existing history
  3. Tap on Compose box to open keyboard
  4. Hold a message and copy it

Expected Result:

Message should be copied and composer should be visible above keyboard

Actual Result:

Message is copied but composer is hidden behind keyboard. The keyboard can't be dismissed by swiping down.
Issue is only reproducible with older devices. Reproduced with iPhone 7/iOS 15.8.2 and iPhone 8/iOS 15.7.

Workaround:

Unknown

Platforms:

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Bug6576519_1724103523927.CUWH4560.mp4

View all open jobs on GitHub

Issue OwnerCurrent Issue Owner: @CortneyOfstad
@IuliiaHerets IuliiaHerets added DeployBlockerCash This issue or pull request should block deployment Bug Something is broken. Auto assigns a BugZero manager. DeployBlocker Indicates it should block deploying the API labels Aug 20, 2024
Copy link

melvin-bot bot commented Aug 20, 2024

Triggered auto assignment to @techievivek (DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.

Copy link

melvin-bot bot commented Aug 20, 2024

Triggered auto assignment to @CortneyOfstad (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

@melvin-bot melvin-bot bot added the Daily KSv2 label Aug 20, 2024
@github-actions github-actions bot added Engineering Hourly KSv2 and removed Daily KSv2 labels Aug 20, 2024
Copy link
Contributor

👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

  1. Identify the pull request that introduced this issue and revert it.
  2. Find someone who can quickly fix the issue.
  3. Fix the issue yourself.

@IuliiaHerets
Copy link
Author

Production - not reproduced

ESHM8018.MP4

@IuliiaHerets
Copy link
Author

We think that this bug might be related to #vip-vsb

@techievivek
Copy link
Contributor

Seems like this is coming from here #47096

@techievivek
Copy link
Contributor

I already see a revert PR here #47669 but there is no progress on the PR so I have bumped the author to see what is holding us from moving forward.

@neil-marcellini
Copy link
Contributor

@IuliiaHerets @techievivek the revert is done, would you please test on staging and confirm it's fixed?

@m-natarajan
Copy link

Issue is not reproducible on build v9. 0. 22-7

SSHK1579.MP4

@techievivek techievivek removed DeployBlockerCash This issue or pull request should block deployment Hourly KSv2 labels Aug 20, 2024
@techievivek
Copy link
Contributor

Going to close this now. Thanks for confirming.

kirillzyusko added a commit to kirillzyusko/react-native-keyboard-controller that referenced this issue Aug 21, 2024
…ation (#557)

## 📜 Description

Fixed a case when `onEnd`/`keyboardDidShow` reports incorrect (previous
frame) keyboard height.

## 💡 Motivation and Context

Fixes regressions introduced in
#539

Initially I thought it's safe to read current keyboard frame in
`didAppear` lifecycle (I thought it'll be always dispatched after
animation finish, so why not to read it). But it was a fatal mistake
because:
- when keyboard changes its size it changes it immediately and in
`didAppear` we'll read old (previous) value ⛔
- on iOS 15 when modal gets hidden, then keyboard appears instantly and
iOS 15 dispatches only one event, so we'll read old frame (i. e. `0`); 🔴
- when iOS 17 with `secureTextEntry` randomly attaches/detaches
`inputAccessoryView`, then we may also encounter a situation, when we
read old frame and we will avoid keyboard incorrectly ❌

So to sum up all previous approaches:
- relying on `duration === 0` is not reliable because keyboard can be
hidden immediately but with `duration === 250` 🤯
- reading current frame in `keyboardDidShow` is not correct approach
because in some situations we may read old values 😔

This PR is a third revision of the solution 😂 Now I learned all lessons
(at least I hope so) and invented a better mechanism. Let's go back to
original problem.

The original problem was in the fact, that a resize event can be
dispatched during animation AND it'll contain incorrect information
about keyboard size (it'll have final destination, though animation
hasn't finished yet). I decided to catch that situation in the code - I
added `didShowDeadline` variable and in `keyboardWillAppear` I set it as
`timestamp + duration`. In `keyboardDidAppear` I verify, that this event
arrived later, and if so, then we read `keyboardHeight` value from
`notification`. Otherwise, if event `didShow` was received before
deadline (i. e. resize event) we can not read data from notification (as
it may not reflect a real state of the things) and instead we are
reading it from keyboard view layer (falling back to what is actually
shown on the screen). Schematically pipeline looks like:

<img width="687" alt="image"
src="https://github.com/user-attachments/assets/a5fd7b2f-ee8c-4c86-82fc-d017bb01f363">

I think such approach is safer and it looks like it will fix all known
issues and at the same time it doesn't introduce additional complexity
to the JS codebase.
 
Fixes
#327 (comment)
Expensify/App#47679

## 📢 Changelog

### iOS

- added `didShowDeadline` variable;
- initialize `didShowDeadline` in `willAppear`;
- check if `didShowDeadline` is bigger than current timestamp, and if
yes, then only then read values from layer. Otherwise as before - from a
notification

## 🤔 How Has This Been Tested?

Tested manually on many devices.

## 📸 Screenshots (if appropriate):

### iOS 15

|Before|After|
|-------|-----|
|<video
src="https://github.com/user-attachments/assets/8253efaa-a20e-4566-b747-7676b6c6cd1e">|<video
src="https://github.com/user-attachments/assets/988340c6-da7e-40f5-bcd2-6ec95e7d1ea4">|

### Keyboard resize

|Before|After|
|-------|-----|
|<video
src="https://github.com/user-attachments/assets/6d008543-38b1-46e3-b792-b4ef813fea77">|<video
src="https://github.com/user-attachments/assets/fc7108d7-e996-4568-8f6e-1cefdf7a3e9a">|

### `KeyboardAvoidingView`

|Before|After|
|-------|-----|
|<video
src="https://github.com/user-attachments/assets/d43f8b53-d442-4a42-a573-d3a2e30a04ad">|<video
src="https://github.com/user-attachments/assets/c7cfe29e-7467-497f-9f4d-b824956f50d6">|

## 📝 Checklist

- [x] CI successfully passed
- [x] I added new mocks and corresponding unit-tests if library API was
changed
@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production labels Aug 22, 2024
@melvin-bot melvin-bot bot changed the title iOS-chat-Composer is hidden behind keyboard after copying a message on iOS 15 [HOLD for payment 2024-08-29] iOS-chat-Composer is hidden behind keyboard after copying a message on iOS 15 Aug 22, 2024
Copy link

melvin-bot bot commented Aug 22, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.23-0 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2024-08-29. 🎊

Copy link

melvin-bot bot commented Aug 22, 2024

BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

  • [@techievivek] The PR that introduced the bug has been identified. Link to the PR:
  • [@techievivek] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:
  • [@techievivek] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:
  • [@techievivek] Determine if we should create a regression test for this bug.
  • [@techievivek] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
  • [@CortneyOfstad] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Engineering Weekly KSv2
Projects
None yet
Development

No branches or pull requests

6 participants