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

[$250] iOS - Chat - Composer not auto scrolled to the bottom when editing message with 10 line breaks #48122

Open
1 of 6 tasks
lanitochka17 opened this issue Aug 27, 2024 · 35 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Engineering External Added to denote the issue can be worked on by a contributor Weekly KSv2

Comments

@lanitochka17
Copy link

lanitochka17 commented Aug 27, 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: 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): applausetester+ak827@applause.expensifail.com
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: @shubham1206agra
@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?

Copy link

melvin-bot bot commented Sep 3, 2024

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

@dominictb
Copy link
Contributor

@shubham1206agra sure, let me raise the upstream PR.

Copy link

melvin-bot bot commented Sep 4, 2024

@deetergp, @VictoriaExpensify, @shubham1206agra Huh... This is 4 days overdue. Who can take care of this?

@VictoriaExpensify
Copy link
Contributor

Not overdue - @dominictb is working on a PR

@melvin-bot melvin-bot bot removed the Overdue label Sep 4, 2024
@trjExpensify
Copy link
Contributor

This is just a pure chat bug, moving to #vip-vsb.

@dominictb
Copy link
Contributor

PR: facebook/react-native#46411

@melvin-bot melvin-bot bot added the Overdue label Sep 10, 2024
@shubham1206agra
Copy link
Contributor

@dominictb I think you need to repro this issue on react-native test app. And file this as bug there too.

@melvin-bot melvin-bot bot removed the Overdue label Sep 10, 2024
@dominictb
Copy link
Contributor

Alright, I'll file an issue in the upstream repo. I could reproduce the bug in the their example app.

Copy link

melvin-bot bot commented Sep 10, 2024

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

Copy link

melvin-bot bot commented Sep 10, 2024

@deetergp @VictoriaExpensify @shubham1206agra this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

@deetergp
Copy link
Contributor

Since this is an upstream bug and out of our control, I'm going to demote it to weekly and check back at that cadence.

@deetergp deetergp added Weekly KSv2 and removed Daily KSv2 labels Sep 10, 2024
@deetergp
Copy link
Contributor

Thanks for filing the bug @dominictb. Can you link it here?

@dominictb
Copy link
Contributor

Hmm, I'm not sure we need to file an issue in the upstream repo. I take a look at this PR facebook/react-native#38679 and it doesn't link to any github issue. Also check the contributing guideline there and saw no requirement of creating issue before submitting PR

However, I added some more reproduction steps and video here, hoping that it is clearer for the reviewer. Let's wait for their feedback then.

Copy link

melvin-bot bot commented Sep 17, 2024

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

1 similar comment
Copy link

melvin-bot bot commented Sep 24, 2024

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

@melvin-bot melvin-bot bot added the Overdue label Sep 24, 2024
@dominictb
Copy link
Contributor

@shubham1206agra @deetergp can I get assigned here? My PR is being reviewed by the Meta team. Thank you!

Copy link

melvin-bot bot commented Sep 24, 2024

@deetergp @VictoriaExpensify @shubham1206agra this issue is now 4 weeks old, please consider:

  • Finding a contributor to fix the bug
  • Closing the issue if BZ has been unable to add the issue to a VIP or Wave project
  • If you have any questions, don't hesitate to start a discussion in #expensify-open-source

Thanks!

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Sep 26, 2024
Copy link

melvin-bot bot commented Sep 26, 2024

📣 @shubham1206agra 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job

Copy link

melvin-bot bot commented Sep 26, 2024

📣 @dominictb 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job
Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Keep in mind: Code of Conduct | Contributing 📖

@melvin-bot melvin-bot bot removed the Overdue label Sep 26, 2024
@dominictb
Copy link
Contributor

@VictoriaExpensify Can you add [HOLD for facebook/react-native#46411] to indicate we're holding for the upstream PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. Engineering External Added to denote the issue can be worked on by a contributor Weekly KSv2
Projects
No open projects
Status: No status
Development

No branches or pull requests

8 participants