You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[$2000] Chat - Previously enter password disappears after second tap on eye icon and 1 more character #21730
Do we feel the clarification will change the outcome of needing an expert contributor? If so, I'll wait, otherwise, let's get one assigned now.
@johncschuster I don't think so the expert contributor will tell you a different solution for this. I have tried all kinds of solutions, and there are 2 kinds of solutions right now (apart from the bullet-like workaround suggested by @AirBorne04 ).
One is mentioned here react/react-native#35668, but this solution has many issues.
It circumvents RN's implementation of text updation completely, which has many event-related calls, such as _onTextInput, _onChange, and _onSelectionChange, which can be important to Native implementation.
It will be applied to all TextInput, whether single-line or multi-line TextInput, and has problems with some languages' text input.
I suggested another one. It overcomes the problems of the previous ones by doing some extra manipulation during becomeFirstResponder because this is the last place we have the value of text before toggling (more specifically, before marking the textinput to clear values on the next input).
On setting secureTextEntry or calling becomeFirstResponder kind of marks dirty, i.e., on the next input event it checks the value of secureTextEntry. If it is true, it will reset the input text. Otherwise, it will not.
@abdulrahuman5196 I think I have written beginEditing by mistake because I inferred the root cause incorrectly at that time. Now, I guess you got the root cause correct.
About you are storing the attributedText on secureTextEntry change and setting it again in becomeFirstResponder
The first store you see happens to solve another issue, which is done by RN Team only. And another one is done by me. I think this has to happen in becomeFirstResponder as after this method, it is very difficult to distinguish between input events done by the user and inputs done as the result of secureTextEntry.
PS: We are calling becomeFirstResponder inside setSecureTextEntry only when the textinput is firstResponder to ensure that we don't accidentally change the focus of the input when not focused.
@johncschuster@abdulrahuman5196 If you are satisfied with my answer, you can proceed with my proposal. If you have any other questions, please ask.
@shubham1206agra I am still not convinced.
The reason is that the text is disappearing when we type a character not just pressing on the input(becomeFirstResponder would called as soon the component become focus). This means even normally after becomeFirstResponder will have proper attributedText. So I doubt if the solution would work.
And why are we doing a [self deleteBackward]; Was this solution working locally for you?
@shubham1206agra I am still not convinced.
The reason is that the text is disappearing when we type a character not just pressing on the input(becomeFirstResponder would called as soon the component become focus). This means even normally after becomeFirstResponder will have proper attributedText. So I doubt if the solution would work.
Yes, on focus it will call becomeFirstResponder. But it will try to clear text after typing any letter after focus.
I will post an example today for the same.
And why are we doing a [self deleteBackward]; Was this solution working locally for you?
To trigger all clearing calls that happens on using secureEntryText. Then reinserting the text.
Yes it's working for me.
I went through all the proposals. I would argue that we shouldn't change this behaviour, as it's the way how it works on IOS natively. It's also how other apps behave, for example strava.
In this gist I recreated this exact behaviour natively (there's a recording below).
If we really wanted to change this, we could implement some type of workaround but it would be hacky. I believe we should just leave it be.
Activity
melvin-bot commentedon Jun 27, 2023
Triggered auto assignment to @johncschuster (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.melvin-bot commentedon Jun 27, 2023
Bug0 Triage Checklist (Main S/O)
Platformsin OP are ✅)melvin-bot commentedon Jun 30, 2023
@johncschuster Whoops! This issue is 2 days overdue. Let's get this updated quick!
melvin-bot commentedon Jul 4, 2023
@johncschuster Still overdue 6 days?! Let's take care of this!
johncschuster commentedon Jul 6, 2023
@dukenv0307 / @aimane-chnaif, it looks like this behavior was found when executing #21367. Can you take a look?
dukenv0307 commentedon Jul 7, 2023
@johncschuster I can't reproduce this bug
johncschuster commentedon Jul 10, 2023
@lanitochka17 are you still able to reproduce this behavior? Please reopen the issue if you can!
71 remaining items
johncschuster commentedon Aug 3, 2023
Do we feel the clarification will change the outcome of needing an expert contributor? If so, I'll wait, otherwise, let's get one assigned now.
shubham1206agra commentedon Aug 4, 2023
@johncschuster I don't think so the expert contributor will tell you a different solution for this. I have tried all kinds of solutions, and there are 2 kinds of solutions right now (apart from the bullet-like workaround suggested by @AirBorne04 ).
One is mentioned here react/react-native#35668, but this solution has many issues.
_onTextInput,_onChange, and_onSelectionChange, which can be important to Native implementation.TextInput, whether single-line or multi-line TextInput, and has problems with some languages' text input.I suggested another one. It overcomes the problems of the previous ones by doing some extra manipulation during
becomeFirstResponderbecause this is the last place we have the value of text before toggling (more specifically, before marking the textinput to clear values on the next input).On setting
secureTextEntryor callingbecomeFirstResponderkind of marks dirty, i.e., on the next input event it checks the value ofsecureTextEntry. If it is true, it will reset the input text. Otherwise, it will not.@abdulrahuman5196 I think I have written beginEditing by mistake because I inferred the root cause incorrectly at that time. Now, I guess you got the root cause correct.
About
you are storing the attributedText on secureTextEntry change and setting it again in becomeFirstResponderThe first store you see happens to solve another issue, which is done by RN Team only. And another one is done by me. I think this has to happen in
becomeFirstResponderas after this method, it is very difficult to distinguish between input events done by the user and inputs done as the result ofsecureTextEntry.PS: We are calling
becomeFirstResponderinsidesetSecureTextEntryonly when the textinput isfirstResponderto ensure that we don't accidentally change the focus of the input when not focused.@johncschuster @abdulrahuman5196 If you are satisfied with my answer, you can proceed with my proposal. If you have any other questions, please ask.
melvin-bot commentedon Aug 7, 2023
@johncschuster, @abdulrahuman5196 Whoops! This issue is 2 days overdue. Let's get this updated quick!
johncschuster commentedon Aug 7, 2023
@abdulrahuman5196 what are your thoughts on the above?
abdulrahuman5196 commentedon Aug 8, 2023
@shubham1206agra I am still not convinced.
The reason is that the text is disappearing when we type a character not just pressing on the input(becomeFirstResponder would called as soon the component become focus). This means even normally after becomeFirstResponder will have proper attributedText. So I doubt if the solution would work.
And why are we doing a
[self deleteBackward];Was this solution working locally for you?shubham1206agra commentedon Aug 9, 2023
Yes, on focus it will call becomeFirstResponder. But it will try to clear text after typing any letter after focus.
I will post an example today for the same.
To trigger all clearing calls that happens on using secureEntryText. Then reinserting the text.
Yes it's working for me.
shubham1206agra commentedon Aug 9, 2023
@abdulrahuman5196 See this
Screen.Recording.2023-08-09.at.11.55.55.AM.mov
SosenWiosen commentedon Aug 9, 2023
Hi, I'm from Software Mansion, an expert agency. I will investigate this more closely and try to help you close out this issue :)
SosenWiosen commentedon Aug 9, 2023
I went through all the proposals. I would argue that we shouldn't change this behaviour, as it's the way how it works on IOS natively. It's also how other apps behave, for example strava.
In this gist I recreated this exact behaviour natively (there's a recording below).
If we really wanted to change this, we could implement some type of workaround but it would be hacky. I believe we should just leave it be.
Slack link for further discussion: https://expensify.slack.com/archives/C01GTK53T8Q/p1691589779246999
@johncschuster @abdulrahuman5196
Video
https://github.com/Expensify/App/assets/43684335/d17fc5f5-602e-4473-9020-e169dee29542johncschuster commentedon Aug 9, 2023
Thanks for raising this, @SosenWiosen! I didn't realize this was native behavior. With that in mind, I agree that we can close this out.