-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Android - Chat - App crashes when sending 2 emojis consecutively #3691
Comments
👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open
|
Triggered auto assignment to @joelbettner ( |
The issue is caused by the fact that Now there is already some code in However, Even if we change this logic, this will only fix the issue in the context of the reproduction steps outlined in the OP. One will still be able to reproduce a crash by typing a message or sending an emoji, tapping elsewhere on the screen to make the Solution 1Just reset the selection state manually each time we submit the form. Add this code: this.setState({selection: {start: 0, end: 0}}); to this handler https://github.com/Expensify/Expensify.cash/blob/main/src/pages/home/report/ReportActionCompose.js#L350-L370 Solution 2Since adding an emoji is the only way to insert something or change the selection inside the It will look like this: addEmojiToTextBox(emoji) {
this.hideEmojiPicker();
const {selection} = this.state;
// Make sure the selection is not out of bounds
if (selection.end > this.comment.length) {
selection.end = this.comment.length;
selection.start = this.comment.length;
}
this.textInput.value = this.comment.slice(0, selection.start)
+ emoji + this.comment.slice(selection.end, this.comment.length);
const updatedSelection = {
start: selection.start + emoji.length,
end: selection.start + emoji.length,
};
this.setState({selection: updatedSelection});
this.setIsFocused(true);
this.focus();
this.updateComment(this.textInput.value);
} I would personally be happy with the first solution as it seems more bulletproof to me, I don't see anything going wrong here with a simple state reset there. One might be concerned with an additional re-render, but that shouldn't be noticeable as there is already a ton re-renders happening on that component and also I would I assume that the additional state update would be bundled with other updates in that callback. |
PROPOSAL I can fix this by removing selection props in text input in android and handle things using direct manipulation in android if there is some need. this approach also fix this issue as well issue Thanks |
@dklymenk I like your first solution. Feel free to assign yourself to this issue and start working on it. Thanks! |
I'm able to reproduce this on 1.0.71-0 but I'm unable to reproduce this on 1.0.73-0, @kavimuru can you confirm that the issue is still occurring on the latest version? Let's hold off on exporting this until we can confirm it's still happening |
Issue is not reproducible in build 1.0.73. |
It seems to be fixed by the PR #3392 |
That's great news! I'm going to close out this issue. |
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:
Expected Result:
Emoji should be picked and sent without any issue
Actual Result:
App is crashing when selecting a second emoji
Workaround:
Unknown
Platform:
Where is this issue occurring?
Web
iOS
Android ✔️
Desktop App
Mobile Web
Version Number: 1.0.72-0
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos:
Bug5119693_Screen_Recording_20210618-220659_Expensifycash.mp4
log.txt

Expensify/Expensify Issue URL:
View all open jobs on Upwork
The text was updated successfully, but these errors were encountered: