input-mask-ios
input-mask-ios copied to clipboard
Fix for UI issue with floating label of MDCTextInputControllerOutlined
I faced with annoying UI issue with MDCTextInputControllerOutlined
.
In case of this type of Material Design textfield controller has MaskedTextFieldDelegate
with params { primaryMaskFormat = "+7-[000]-[000]-[0000]", autocompleteOnFocus = true}
, on first focus floating point doesn't display correctly.
If autocompleteOnFocus=false
or mask without leading chars (example [000]-[000]-[0000]
), everything works fine.
My suggestion, the issue related to method put(...)
, it changes the textfield text in wrong moment.
Later execution in main.async{}
fixes everything.
Please, consider the code review to put all same code patterns in textFieldDidBeginEditing
and maybe textViewDidBeginEditing
into main.async{}
blocks.
Please, consider the code review to put all same code patterns in textFieldDidBeginEditing and maybe textViewDidBeginEditing into main.async{} blocks.
What?..
Right now your argument looks like your implementation is altering UI from a background thread, so you expect our library to defend against this nonsense, am I correct?
I am talking only about Material Design Text fields for iOS compatibility.
The issue is not with UI or non-UI threads, but with chain of UITextFieldDelegate
callbacks, probably MDCTextInputControllerOutlined
expects, but this expected order brakes method put(...)
call inside textFieldDidBeginEditing
.
This is just my point of view on this issue.
@ekrivenja, okay.
May I see an example of usage?
I haven't found any references to our library within the Material Design library docs, nor I have found any unusual UITextFieldDelegate
calls in their git.
Hey @taflanidi , just updated the project sample, please find out it there
https://github.com/ekrivenja/input-mask-ios/tree/demo-material-issue
I've made the adjustments, thanks!