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

Cursor position issue when we toggle between SecureTextEntry. Using Material (2.16.2) #1119

Closed
MuhammadNayabButt opened this issue Jul 23, 2018 · 5 comments

Comments

@MuhammadNayabButt
Copy link

There is an issue. Whe we toggle to unhide our Text in a password field. The cursor is not on its appropriate position.

screen shot 2018-07-23 at 4 32 18 pm
screen shot 2018-07-23 at 4 33 22 pm

@MuhammadNayabButt
Copy link
Author

I am using "Using Material (2.16.2)"

@MuhammadNayabButt MuhammadNayabButt changed the title Cursor position issue when we toggle between SecureTextEntry. Cursor position issue when we toggle between SecureTextEntry. Using Material (2.16.2) Jul 23, 2018
@OrkhanAlikhanov
Copy link
Contributor

Hey! Thank you for reporting this. It's my bad. We'll fix this soon

@MuhammadNayabButt
Copy link
Author

MuhammadNayabButt commented Jul 23, 2018

@OrkhanAlikhanov Thanks for your prompt reply.
I have noticed when we hide text(enable secure entry) the cursor wisely goes back to its position.
The problem come when we unhide the text(disable secure text) then the cursor does not move.
Although this function is getting called

`
@objc
func handleVisibilityIconButton() {
/// Workaround: Reassign text to reset cursor
/// This is a known issue with UITextField
/// Source: https://stackoverflow.com/questions/14220187/uitextfield-has-trailing-whitespace-after-securetextentry-toggle
let textHolder = text
text = " "
text = textHolder

UIView.transition(
  with: (visibilityIconButton?.imageView)!,
  duration: 0.3,
  options: .transitionCrossDissolve,
  animations: { [weak self] in
    guard let `self` = self else {
      return
    }
    
    self.isSecureTextEntry = !self.isSecureTextEntry
})

}
}`

@OrkhanAlikhanov
Copy link
Contributor

Thank you for your investigation. I've sent a PR. See #1120

@daniel-jonathan
Copy link
Member

Please find a fix for this issue in Material 2.16.4. Thank you!

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

No branches or pull requests

3 participants