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-12-17] [HOLD for facebook/react-native#46411[$250] iOS - Chat - Composer not auto scrolled to the bottom when editing message with 10 line breaks #48122

Closed
1 of 6 tasks
lanitochka17 opened this issue Aug 27, 2024 · 55 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor

Comments

@lanitochka17
Copy link

lanitochka17 commented Aug 27, 2024

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Version Number: 9.0.25-8
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/4895266
Email or phone of affected tester (no customers): [email protected]
Issue reported by: Applause - Internal Team

Action Performed:

  1. Launch New Expensify app
  2. Navigate to a DM
  3. Send a message with 10 line breaks
  4. Edit the message

Expected Result:

Compose box should be auto scrolled to the bottom of the message, the end of the message should be visible.
Cursor should be placed at the end of the message

Actual Result:

Compose box is not auto scrolled to the end of the message, 6th is the last line visible to the user

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

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

Screenshots/Videos

Add any screenshot/video evidence

Bug6584462_1724784043034.staging.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01c809bc476538a5ae
  • Upwork Job ID: 1828571296040895701
  • Last Price Increase: 2024-09-24
  • Automatic offers:
    • shubham1206agra | Reviewer | 104134700
    • dominictb | Contributor | 104134702
Issue OwnerCurrent Issue Owner: @VictoriaExpensify
@lanitochka17 lanitochka17 added the DeployBlockerCash This issue or pull request should block deployment label Aug 27, 2024
Copy link

melvin-bot bot commented Aug 27, 2024

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

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.

@lanitochka17
Copy link
Author

Production:

Bug6584462_1724784043018.prod.mp4

@deetergp
Copy link
Contributor

Nothing in the deploy checklist jumps out at me as the cause of this. But I also think it isn't significant enough to block on, so I am going to remove the blocker label, set to Daily, and make it External.

@deetergp deetergp added Daily KSv2 External Added to denote the issue can be worked on by a contributor and removed DeployBlockerCash This issue or pull request should block deployment Hourly KSv2 labels Aug 27, 2024
Copy link

melvin-bot bot commented Aug 27, 2024

Job added to Upwork: https://www.upwork.com/jobs/~01c809bc476538a5ae

@melvin-bot melvin-bot bot changed the title iOS - Chat - Composer not auto scrolled to the bottom when editing message with 10 line breaks [$250] iOS - Chat - Composer not auto scrolled to the bottom when editing message with 10 line breaks Aug 27, 2024
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Aug 27, 2024
Copy link

melvin-bot bot commented Aug 27, 2024

Triggered auto assignment to Contributor-plus team member for initial proposal review - @shubham1206agra (External)

@deetergp deetergp added the Bug Something is broken. Auto assigns a BugZero manager. label Aug 27, 2024
Copy link

melvin-bot bot commented Aug 27, 2024

Triggered auto assignment to @VictoriaExpensify (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.

@shubham1206agra
Copy link
Contributor

@MrRefactor @WoLewicki Can you please look into this?

@bigshoesdev
Copy link

I will use a combination of ref and the setNativeProps method to programmatically set the cursor position.

Copy link

melvin-bot bot commented Aug 28, 2024

📣 @bigshoesdev! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:

  1. Make sure you've read and understood the contributing guidelines.
  2. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
  3. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
  4. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
    Screen Shot 2022-11-16 at 4 42 54 PM
    Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>

@NJ-2020
Copy link
Contributor

NJ-2020 commented Aug 28, 2024

Proposal

Please re-state the problem that we are trying to solve in this issue.

iOS - Chat - Composer not auto scrolled to the bottom when editing message with 10 line breaks

What is the root cause of that problem?

We do not wrap the compose text input inside the ScrollView and we do not auto scroll to the end inside the input

What changes do you think we should make in order to solve the problem?

We can wrap the compose input inside the ScrollView and link the ScrollView to useRef and invoke the scrollEnd function
scrollViewRef.current?.scrollToEnd({ animated: true })

What alternative solutions did you explore? (Optional)

@dominictb
Copy link
Contributor

Proposal

Please re-state the problem that we are trying to solve in this issue.

Compose box is not auto scrolled to the end of the message, 6th is the last line visible to the user

What is the root cause of that problem?

This issue happen on native TextInput in iOS, but not Android. The reason is because in Android, when we set autoFocus=true or when we call focus() command from React, internall RN will call this function requestFocusInternal here, and due to this call, the AppCompatEditText will scroll down to show the current text editor selection into view. Read more in here

Unfortunately, we don't have the same mechanism in the iOS. We only call becomeFirstResponder for the TextView when calling focus() command programmtically or when autoFocus=true here

What changes do you think we should make in order to solve the problem?

Based on this: facebook/react-native#38679, we can add a function in RCTTextInputComponentView.mm

- (void)scrollCursorIntoView {
    // Assuming you have a UITextView or similar text input view
    UITextRange *selectedRange = _backedTextInputView.selectedTextRange;
    // Updating the UITextView attributedText, for example changing the lineHeight, the color or adding
    // a new paragraph with \n, causes the cursor to move to the end of the Text and scroll.
    // This is fixed by restoring the cursor position and scrolling to that position (iOS issue 652653).
    if (selectedRange.empty) {
      // Maintaining a cursor position relative to the end of the old text.
      NSInteger offsetStart = [_backedTextInputView offsetFromPosition:_backedTextInputView.beginningOfDocument
                                                            toPosition:selectedRange.start];
      [_backedTextInputView scrollRangeToVisible:NSMakeRange(offsetStart, 0)];
    }
}

And add the calls when the text view is being auto focused or focused programmatically here

....
   [_backedTextInputView becomeFirstResponder];
   [self scrollCursorIntoView];
....

What alternative solutions did you explore? (Optional)

@melvin-bot melvin-bot bot added the Overdue label Aug 30, 2024
@shubham1206agra
Copy link
Contributor

@melvin-bot melvin-bot bot removed the Overdue label Aug 30, 2024
@shubham1206agra
Copy link
Contributor

@dominictb Can you create an upstream PR to fix this?

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Monthly KSv2 labels Dec 4, 2024
@dominictb
Copy link
Contributor

@shubham1206agra Please review the PR: #53566

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Dec 10, 2024
@melvin-bot melvin-bot bot changed the title [HOLD for facebook/react-native#46411[$250] iOS - Chat - Composer not auto scrolled to the bottom when editing message with 10 line breaks [HOLD for payment 2024-12-17] [HOLD for facebook/react-native#46411[$250] iOS - Chat - Composer not auto scrolled to the bottom when editing message with 10 line breaks Dec 10, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Dec 10, 2024
Copy link

melvin-bot bot commented Dec 10, 2024

Reviewing label has been removed, please complete the "BugZero Checklist".

Copy link

melvin-bot bot commented Dec 10, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.73-8 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-12-17. 🎊

For reference, here are some details about the assignees on this issue:

Copy link

melvin-bot bot commented Dec 10, 2024

@shubham1206agra / @dominictb @VictoriaExpensify @shubham1206agra / @dominictb The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Dec 17, 2024
@shubham1206agra
Copy link
Contributor

shubham1206agra commented Dec 19, 2024

BugZero Checklist:

  • [Contributor] Classify the bug:
Bug classification

Source of bug:

  • 1a. Result of the original design (eg. a case wasn't considered)
  • 1b. Mistake during implementation
  • 1c. Backend bug
  • 1z. Other: RN bug

Where bug was reported:

  • 2a. Reported on production (eg. bug slipped through the normal regression and PR testing process on staging)
  • 2b. Reported on staging (eg. found during regression or PR testing)
  • 2d. Reported on a PR
  • 2z. Other:

Who reported the bug:

  • 3a. Expensify user
  • 3b. Expensify employee
  • 3c. Contributor
  • 3d. QA
  • 3z. Other:
  • [Contributor] 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: NA since this is RN bug

  • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source 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: NA

  • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

  • [BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.

    Link to issue:

Regression Test Proposal

Test:

  1. Launch Expensify app.
  2. Navigate to a report.
  3. Send a message with 10 line breaks.
  4. Edit the message.
  5. Verify that the message is scrolled to bottom.

Do we agree 👍 or 👎

@melvin-bot melvin-bot bot added the Overdue label Dec 19, 2024
Copy link

melvin-bot bot commented Dec 20, 2024

@deetergp, @VictoriaExpensify, @shubham1206agra, @dominictb Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@shubham1206agra
Copy link
Contributor

Ready for payment.

@deetergp
Copy link
Contributor

Hey @shubham1206agra 👋 @VictoriaExpensify was OOO this week but will be back on Monday and will process payment then.

@VictoriaExpensify
Copy link
Contributor

@shubham1206agra 's offer had expired and I couldn't reissue it under the old job posting as that has also expired. So I have created a new job posting and issued you both new offers @shubham1206agra and @dominictb - can you please accept these so I can process your payments?

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Dec 22, 2024
Copy link

melvin-bot bot commented Dec 26, 2024

@deetergp, @VictoriaExpensify, @shubham1206agra, @dominictb Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

Copy link

melvin-bot bot commented Dec 30, 2024

@deetergp, @VictoriaExpensify, @shubham1206agra, @dominictb Still overdue 6 days?! Let's take care of this!

@shubham1206agra
Copy link
Contributor

This is ready for payment

@VictoriaExpensify
Copy link
Contributor

@melvin-bot melvin-bot bot removed the Overdue label Dec 31, 2024
@VictoriaExpensify
Copy link
Contributor

Payment summary:

Contributor: @dominictb paid $250 via Upwork
C+: @shubham1206agra paid $250 via Upwork

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. Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor
Projects
Status: Done
Development

No branches or pull requests

8 participants