App
App copied to clipboard
[HOLD #37147 RN PR][$2000] iOS - Chat - Cursor in the second and following lines touches the symbols of the previous line
If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!
Action Performed:
- Open the app
- Sign in with any account
- Go to any chat
- Type anything on the composer until you reach the end of the line
Expected Result:
Cursor in the second and following lines NOT touches the symbols of the previous line
Actual Result:
Cursor in the second and following lines touches the symbols of the previous line
Workaround:
UNknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
- [ ] Android / native
- [ ] Android / Chrome
- [x] iOS / native
- [ ] iOS / Safari
- [ ] MacOS / Chrome / Safari
- [ ] MacOS / Desktop
Version Number: 1.2.78.0
Reproducible in staging?: Yes
Reproducible in production?: yes
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos: Any additional supporting documentation

Expensify/Expensify Issue URL:
Issue reported by: Applause - Internal Team
Slack conversation:
Upwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~01dac248cbb18d206b
- Upwork Job ID: 1632682995228594176
- Last Price Increase: 2023-03-27
Triggered auto assignment to @sakluger (Bug
), see https://stackoverflow.com/c/expensify/questions/14418 for more details.
Bug0 Triage Checklist (Main S/O)
- [ ] This "bug" occurs on a supported platform (ensure
Platforms
in OP are ✅) - [ ] This bug is not a duplicate report (check E/App issues and #expensify-bugs)
- If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
- [ ] This bug is reproducible using the reproduction steps in the OP. S/O
- If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
- If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
- [ ] This issue is filled out as thoroughly and clearly as possible
- Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
- [ ] I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync
I was able to reproduce, this happens for letters that extend below the line (like p
and g
). In the screenshot below, you can see that the cursor slightly overlaps with the g
from the line above.
Job added to Upwork: https://www.upwork.com/jobs/~01dac248cbb18d206b
Current assignee @sakluger is eligible for the External assigner, not assigning anyone new.
Triggered auto assignment to Contributor-plus team member for initial proposal review - @Santhosh-Sellavel (External
)
Triggered auto assignment to @alex-mechler (External
), see https://stackoverflow.com/c/expensify/questions/7972 for more details.
Proposal
Please re-state the problem that we are trying to solve in this issue.
[iOS] Chat: The cursor of the composer is located at the wrong line when touched.
What is the root cause of that problem?
React Native's TextInput
component has an issue on iOS regarding the line height - https://github.com/facebook/react-native/issues/28012
What changes do you think we should make in order to solve the problem?
We can fix it by just removing the lineHeight
property in the styles.
📣 @shaunnewsum2020! 📣
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:
- 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>
Contributor details Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~01619249d793a96491
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
Still waiting for more proposals Melvin
@alex-mechler This seems to be something that is the default behaviour on RN Text input for iOS. It is not dependent on the line height of the input. I have created a Snack for you to confirm this. I think we should do nothing here.

Not overdue, waiting for proposals!
Proposal
Please re-state the problem that we are trying to solve in this issue.
iOS - Chat - Cursor in the second and following lines touches the symbols of the previous line
What is the root cause of that problem?
React Native's TextInput component has an issue on iOS regarding the line height. The height of the cursor becomes the same as the line height. So touches the previous line.
What changes do you think we should make in order to solve the problem?
We can fix it by overriding caretRectForPosition
function and then changing the height of the cursor for IOS for multiline input.
#pragma mark - Caret Manipulation
- (CGRect)caretRectForPosition:(UITextPosition *)position
{
if (_caretHidden) {
return CGRectZero;
}
CGRect rect = [super caretRectForPosition:position];
UIFont *font = self.font;
rect.size.height = font.pointSize - font.descender;
rect.origin.y -= font.descender;
return rect;
}
UI after applying the above code

What alternative solutions did you explore? (Optional)
None
📣 @soumyajit4419! 📣
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:
- 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>
Contributor details Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~01976dd3e633071039
⚠️ Missing/invalid email or upwork profile link. Please make sure you add both your Expensify email and Upwork profile link in the format specified.
Contributor details Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~01976dd3e633071039
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
@alex-mechler This seems to be something that is the default behaviour on RN Text input for iOS. It is not dependent on the line height of the input. I have created a Snack for you to confirm this. I think we should do nothing here.
@allroundexperts Even if it is the default behavior, it is still a display issue. We should fix this regardless of if it is a default behavior.
@soumyajit4419 What's the logic beyond adding 4
to originalRect.origin.y
in CGRect computation?
Also, can you spin up a PR against RN Upstream, so let's hear thoughts from the RN maintainers too?
@soumyajit4419 What's the logic beyond adding
4
tooriginalRect.origin.y
in CGRect computation? Also, can you spin up a PR against RN Upstream, so let's hear thoughts from the RN maintainers too?
We are decreasing the height of the original react. But its origin.y
starts from top . So to bring it down I have added
y + 4
. So that it stays in the correct position.
I have also created a PR in react-native repository:- https://github.com/facebook/react-native/pull/36484
@sakluger @alex-mechler @Santhosh-Sellavel 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!
We reduce the height of caret based on the font
- (CGRect)caretRectForPosition:(UITextPosition *)position
{
if (_caretHidden) {
return CGRectZero;
}
CGRect originalRect = [super caretRectForPosition:position];
UIFont *font = self.font;
originalRect.size.height = font.pointSize - font.descender;
return CGRectMake(originalRect.origin.x, originalRect.origin.y - font.descender , originalRect.size.width, originalRect.size.height);
}
This solution is based on the comments of the react-native PR. I have also updated my upstream PR.
Cool let's wait for a review there, Resolve conflicts on the PR too. Can you share your recording to see how it looks now?
Cool let's wait for a review there, Resolve conflicts on the PR too. Can you share your recording to see how it looks now?
I have resolved the conflict in the PR. I have attached the recordings below
https://user-images.githubusercontent.com/46092576/226199938-78400fe7-1f25-4522-8ab9-b312c1197d5b.mov
Thanks, LGTM, let's wait for the review!
@Santhosh-Sellavel
The react-native PR is approved PR
Can you please check it.