App
App copied to clipboard
[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
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:
- Launch New Expensify app
- Navigate to a DM
- Send a message with 10 line breaks
- 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
- [x] iOS: Native
- [ ] iOS: mWeb Safari
- [ ] MacOS: Chrome / Safari
- [ ] MacOS: Desktop
Screenshots/Videos
Add any screenshot/video evidence
https://github.com/user-attachments/assets/b88133ed-09cc-4e08-9944-01fc889c14ab
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 Owner
Current Issue Owner: @VictoriaExpensify
Triggered auto assignment to @deetergp (DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.
:wave: 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:
- Identify the pull request that introduced this issue and revert it.
- Find someone who can quickly fix the issue.
- Fix the issue yourself.
Production:
https://github.com/user-attachments/assets/6c7611c7-712d-4811-843e-fea58714c94d
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.
Job added to Upwork: https://www.upwork.com/jobs/~01c809bc476538a5ae
Triggered auto assignment to Contributor-plus team member for initial proposal review - @shubham1206agra (External)
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.
@MrRefactor @WoLewicki Can you please look into this?
📣 @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:
- Make sure you've read and understood the contributing guidelines.
- 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.
- 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.
- Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>
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)
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: https://github.com/facebook/react-native/pull/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)
Asked for 2nd opinion here https://expensify.slack.com/archives/C066HJM2CAZ/p1725018537186099
@dominictb Can you create an upstream PR to fix this?
@deetergp, @VictoriaExpensify, @shubham1206agra Whoops! This issue is 2 days overdue. Let's get this updated quick!
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸
@shubham1206agra sure, let me raise the upstream PR.
@deetergp, @VictoriaExpensify, @shubham1206agra Huh... This is 4 days overdue. Who can take care of this?
Not overdue - @dominictb is working on a PR
This is just a pure chat bug, moving to #vip-vsb.
PR: https://github.com/facebook/react-native/pull/46411
@dominictb I think you need to repro this issue on react-native test app. And file this as bug there too.
Alright, I'll file an issue in the upstream repo. I could reproduce the bug in the their example app.
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸
@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!
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.
Thanks for filing the bug @dominictb. Can you link it here?
Hmm, I'm not sure we need to file an issue in the upstream repo. I take a look at this PR https://github.com/facebook/react-native/pull/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.
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸
@shubham1206agra @deetergp can I get assigned here? My PR is being reviewed by the Meta team. Thank you!