Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
Material
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dmitriy Stepanets
Material
Commits
596c5b96
Commit
596c5b96
authored
Jul 23, 2018
by
Orkhan Alikhanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed cursor position after isSecureTextEntry toggle
parent
c81611ea
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
7 deletions
+11
-7
Sources/iOS/TextField.swift
+11
-7
No files found.
Sources/iOS/TextField.swift
View file @
596c5b96
...
@@ -207,6 +207,7 @@ open class TextField: UITextField {
...
@@ -207,6 +207,7 @@ open class TextField: UITextField {
open
override
var
isSecureTextEntry
:
Bool
{
open
override
var
isSecureTextEntry
:
Bool
{
didSet
{
didSet
{
updateVisibilityIcon
()
updateVisibilityIcon
()
fixCursorPosition
()
}
}
}
}
...
@@ -673,13 +674,6 @@ fileprivate extension TextField {
...
@@ -673,13 +674,6 @@ fileprivate extension TextField {
/// Handles the visibilityIconButton TouchUpInside event.
/// Handles the visibilityIconButton TouchUpInside event.
@objc
@objc
func
handleVisibilityIconButton
()
{
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
(
UIView
.
transition
(
with
:
(
visibilityIconButton
?
.
imageView
)
!
,
with
:
(
visibilityIconButton
?
.
imageView
)
!
,
duration
:
0.3
,
duration
:
0.3
,
...
@@ -801,4 +795,14 @@ private extension TextField {
...
@@ -801,4 +795,14 @@ private extension TextField {
rightView
?
.
grid
.
views
.
remove
(
at
:
i
)
rightView
?
.
grid
.
views
.
remove
(
at
:
i
)
}
}
/**
Reassign text to reset cursor position.
Fixes issue-1119. Previously issue-1030, and issue-1023.
*/
func
fixCursorPosition
()
{
let
t
=
text
text
=
nil
text
=
t
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment