Skip to content
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

Issue with UITextField secureTextEntry = YES #779

Closed
paulyoung opened this issue Sep 3, 2013 · 9 comments
Closed

Issue with UITextField secureTextEntry = YES #779

paulyoung opened this issue Sep 3, 2013 · 9 comments
Labels

Comments

@paulyoung
Copy link
Contributor

I hope this is the right forum for this type of question. If not I can post to StackOverflow instead.

I'm using v2.0-RC-2 and have set up a view controller, view model and a view which contains several text fields.

The current setup is similar to an example from the documentation where the submit button is enabled when the view model is valid (currently when all properties have length > 0).

Everything works well except for when I set secureTextEntry = YES on a text field. If that field already has text entered (either pre-populated by the view model, or entered by the user), I'm able to focus on the field and clear the text without the button being disabled.

I believe this is to do with the unique behavior of a text field with secureTextEntry = YES which clears the entire field on the first keypress (not just "delete") after gaining focus.

If I type something and then delete it again, since I'm already focused I must delete each character individually and the button is disabled as expected.

I'm assuming this is something to do with the UITextFieldTextDid... notifications so not sure if a change to RAC can address this, but would appreciate any help in finding a workaround if not.

Thanks.

@paulyoung
Copy link
Contributor Author

FWIW I tried explicitly setting _passwordField.clearsOnBeginEditing = NO; as a workaround but it had no effect.

@kastiglione
Copy link
Member

Are you saying the text field is always being cleared on focus, even with clearsOnBeginEditing set to NO?

If you'd like a signal that captures the event that clears the field, you could create your own signal based on -rac_textSignal's implementation. Instead of using UIControlEventEditingChanged, use UIControlEventAllEditingEvents.

@paulyoung
Copy link
Contributor Author

Not on focus, but on the first keypress after gaining focus. When this happens I get into a weird state, as if the change didn't register.

I'll give your suggestion a try and report back.

@paulyoung
Copy link
Contributor Author

I tried this and it seems that no event is fired when the field is cleared in this way.

@paulyoung
Copy link
Contributor Author

The behavior I'm seeing is described in this StackOverflow question.

@paulyoung
Copy link
Contributor Author

I believe that this event not being triggered is a bug with the iOS SDK I'm targeting so I filed a Radar.

@kastiglione
Copy link
Member

Thanks for the follow up. I'll close this issue.

@paulyoung
Copy link
Contributor Author

For reference: rdar://14904641

@paulyoung
Copy link
Contributor Author

This issue was fixed in one of the betas after I filed the radar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants