-
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
[HOLD for payment 2023-09-29] [$1000] Android - Login - Linkified email from external app is pasted as linkified email in email field #21411
Comments
Triggered auto assignment to @Christinadobrzyn ( |
Bug0 Triage Checklist (Main S/O)
|
ProposalPlease re-state the problem that we are trying to solve in this issue.When pasting rich text to the e-mail field, the formatting is preserved, although we'd like the text to be plain text. What is the root cause of that problem?On Android, <TextInput>
Hello, <Text style={{color:'red'}}>World</Text>
</TextInput> Also, formatted text can be pasted by the user. What changes do you think we should make in order to solve the problem?Surprisingly, there is no way to disable the rich text properties of the There is a workaround, though. One can heuristically detect when the text is pasted and change it to some other text (so the internal formatting markers are cleared), but immediately change it back. We could introduce these helpers: const zeroWidthSpace = '\u8203';
/**
* A very simple heuristic for detecting whether the text was pasted
*
* @param {String} oldText
* @param {String} newText
* @return {Boolean}
*/
function isTextPasted(oldText, newText) {
return Math.abs(newText.length - oldText.length) > 1;
}
/**
* A helper for setting a TextInput-managed state, which ensures that the
* text keeps being plain, even when formatted text is pasted by the user.
*
* @param {Object} component
* @param {Function} buildState
* @param {String} oldText
* @param {String} newText
*/
function setPlainTextInputState(component, buildState, oldText, newText) {
if (isTextPasted(oldText, newText)) {
// Set a similar but different text, so TextInput clears formatting markers
component.setState(buildState(
`${zeroWidthSpace}${newText}${zeroWidthSpace}`,
), () => {
// Change back to the pasted text (in the plain text)
component.setState(buildState(newText));
});
} else {
// If it doesn't look like a paste, set the state directly to minimize flickering
component.setState(buildState(newText));
}
} And then use them in /**
* Handle text input and clear formError upon text change
*
* @param {String} newText
*/
onTextInput(newText) {
setPlainTextInputState(
this,
(text) => ({login: text}),
this.state.login,
newText,
);
this.setState({
formError: null,
});
// ...
} |
I'm not able to replicate this - reaching out in Slack to get more specific directions on how the email is copied. |
You can copy any link, for what it's worth. Let's say from here. When I copied from Chrome, I had to use text selection. RichText-1-compressed.mp4 |
I might not be able to get this to work on Browserstack but it seems like enough people can reproduce it so I'll send it to External. |
Job added to Upwork: https://www.upwork.com/jobs/~01fec00bf5a9d050cf |
Triggered auto assignment to @Gonals ( |
Current assignee @Christinadobrzyn is eligible for the External assigner, not assigning anyone new. |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @s77rt ( |
ProposalPlease re-state the problem that we are trying to solve in this issue.Text is copy pasted as rich text on Android TextInput instead of Plain Text. What is the root cause of that problem?Android EditText and iOS UITextField/UITextView have different copy/paste behavior.
What changes do you think we should make in order to solve the problem?The issue is a bug in react-native facebook/react-native#31442:
More info at #21411 (comment) The solution consists of:
I have included below the test performed in an Android App. Reproducing the issue on Android2023-06-27.22-28-06.mp4Fixing the issue on Android2023-06-28.21-26-53.mp4Testing the solution on React Native2023-06-29.17-49-09.mp4 |
@fabriziobertoglio1987 Just for the sake of clarity, there's an open issue in React Native. It's not confirmed yet whether it's considered a bug or intended behavior. |
@cubuspl42 Thanks for the proposal. Your RCA makes sense but I don't think we should follow the workaround solution especially since this is broken at a lower level. |
@fabriziobertoglio1987 Thanks for the proposal. Your RCA makes sense. I like the simplicity of the solution treating "Paste" as "Paste as plaintext" but then we will have two options that do the same thing, not really a blocker, but can we control the context menu options to show? |
Thanks @s77rt. This is my update for today.
I removed the Removed the option in insert mode with setCustomInsertionActionModeCallbackThe user opens the context menu with the long press action on the cursor. Before applying the FixResult:
2023-06-28.21-14-46.mp4After applying the FixResult:
2023-06-28.21-26-53.mp4Removed the option in selection mode with setCustomSelectionActionModeCallbackThe user opens the context menu with the long press action on the selected text. Before applying the FixResult:
2023-06-28.21-24-37.mp4After applying the FixResult:
Sourcecode: https://user-images.githubusercontent.com/24992535/249484884-44e4577c-3ca7-4ec2-9ecd-364c7c2ee610.mp4 2023-06-28.21-27-15.mp4 |
Native and JavaScript state are not in sync. The EditText Native style changes the style of a JavaScript Controlled TextInput.https://snack.expo.dev/@fabrizio.bertoglio/controlled-component-style-not-working
Detailed steps to reproduce the issue:
Conclusion:
<Text style={{color: "red"}}>attached screenshot. https://githddd</Text>
<Text style={{color: "red"}}>attached screenshot.
<Text style={{color: "blue", textDecorationColor: "blue", textDecorationLine: "underline"}}>https://gith</Text>
<Text style={{color: "red", textDecorationColor: "red", textDecorationLine: "underline" }}>ddd</Text>
</Text> On Android different Span will expand to the left/right characters, and not respect the style defined in JavaScript.
2023-06-28.21-56-29.mp4 |
@fabriziobertoglio1987 Thanks for the update. I think we can start with treating "Paste" as "Paste as plaintext" (make a PR for that). Then we can make a follow up PR to hide the redundant "Paste as plaintext" if needed. 🎀 👀 🎀 C+ reviewed BTW, can you please use heading styles instead of |
Triggered auto assignment to @pecanoro, see https://stackoverflow.com/c/expensify/questions/7972 for more details. |
Update 10/09I prepared a branch for the PR. I tested the branch and did not detect issue, but most of the patches do not work on 0.72.4. I will try to complete the task by the 13th of September, as I will be away for some time from the 14th of September. Patches that can be deleted because already merged in the Upstream branch. May require updating dependency.
Patches that have been reapplied for 0.72.4.
Patches that had no issues with 0.72.4:
Issue ds300/patch-package#487 https://expensify.slack.com/archives/C01GTK53T8Q/p1692709363724909 |
Update 12/09Update to react-native 0.72.4 Issues with patch NumberOfLines https://hermesengine.dev/docs/building-and-running/#executing-javascript-with-hermes
Maybe patch-package needs to compile the JavaScript changes to bytecode using the hermes binary? Tomorrow I will verify if the hermes binary is present under |
Update 13/09Published DRAFT pull request #27320 to upgrade to react-native 0.72.4 |
Update 15/09Completed DRAFT pull request #27320 to upgrade to react-native 0.72.4. I will move the PR to ready to review this weekend. |
Update 16/09Moved the PR #27320 to ready to review. |
Based on my calculations, the pull request did not get merged within 3 working days of assignment. Please, check out my computations here:
On to the next one 🚀 |
|
The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.72-11 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 2023-09-29. 🎊 After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.
For reference, here are some details about the assignees on this issue:
As a reminder, here are the bonuses/penalties that should be applied for any External issue:
|
BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:
|
|
Payouts due: Issue Reporter: NA Eligible for 50% #urgency bonus? N based on #21411 (comment) but also it looks like the PR was created Sept 13th & merged Sept 19th - does that sound right? Upwork job is here. |
@Christinadobrzyn Can you please double check the Upwork job. It seems unavailable. |
@s77rt, @Gonals, @fabriziobertoglio1987, @Christinadobrzyn Whoops! This issue is 2 days overdue. Let's get this updated quick! |
Hi @s77rt the Upwork job is closed, sorry I didn't realise that meant you couldn't see it. You and @fabriziobertoglio1987 were automatically hired so I can pay you through the closed job still. Will you confirm the payment details here are good and I'll pay this? #21411 (comment) |
@Christinadobrzyn The payout summary looks correct 👍 |
Perfect! Thanks for confirming @s77rt! I have paid both you and @fabriziobertoglio1987 based on the payment structure here I'll close this out but please let me know if you need anything else! |
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Action Performed:
Expected Result:
Email is not linkified
Actual Result:
Email is linkified
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Version Number: 1.3.31.2
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
Bug6103773_Screen_Recording_20230623_181250_New_Expensify.mp4
Expensify/Expensify Issue URL:
Issue reported by: Applause - Internal Team
Slack conversation:
Upwork Automation - Do Not Edit
The text was updated successfully, but these errors were encountered: