input-mask-ios icon indicating copy to clipboard operation
input-mask-ios copied to clipboard

Fix for UI issue with floating label of MDCTextInputControllerOutlined

Open ekrivenja opened this issue 3 years ago • 4 comments

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.

ekrivenja avatar Sep 14 '20 21:09 ekrivenja

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?

taflanidi avatar Sep 14 '20 23:09 taflanidi

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 avatar Sep 15 '20 08:09 ekrivenja

@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.

taflanidi avatar Sep 15 '20 11:09 taflanidi

Hey @taflanidi , just updated the project sample, please find out it there
https://github.com/ekrivenja/input-mask-ios/tree/demo-material-issue

ekrivenja avatar Sep 16 '20 09:09 ekrivenja

I've made the adjustments, thanks!

taflanidi avatar Apr 06 '23 12:04 taflanidi