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

If you don't set the detail text for a TextField in Storyboard, it won't appear when set from code later #583

Closed
balazsgerlei opened this issue Nov 6, 2016 · 10 comments
Assignees

Comments

@balazsgerlei
Copy link

I use the detail property of TextFields to display an error message when the validation fails for a TextField. After updating to 2.3.2, it won't appear unless I set it in the Storyboard. But I don't want to display anything unless a validation fails, and it was working before switching to 2.x.

My workaround for now is to set a single space as "details" in the Storyboard.

@daniel-jonathan
Copy link
Member

Thank you for sharing this. Today I am planning to look at the issues with the TextField. Sorry for the inconvenience.

@balazsgerlei
Copy link
Author

No worries, it is a cool library with a ton of features! ;)
I a currently going through the migration of an app to Swift 3.0 and I know how exhausting it can be.

@daniel-jonathan
Copy link
Member

Yes, takes time to maintain Material, that said, it is a lot of fun to do so :)

@daniel-jonathan
Copy link
Member

There was an issue when the text property was equal to nil. I had fixed that, and now in development there is a modified TextField. Would you be able to test it to see if your issue still persists? Thank you!

@daniel-jonathan
Copy link
Member

If this is not fixed, could you send me a sample project that I can use as a reference and reproduce the issue? Thank you!

@balazsgerlei
Copy link
Author

Hi!
I had time to test it, but sadly the issue is still there. I created a repo to illustrate:
https://github.com/balazsgerlei/MaterialTextViewTest

In this project I added to TextView. I set the detail property of the first one to a single space in Storyboard and didn't set anyting to the second when. When you click the button below the two TextField, I set the detail and detailColor property for both TextFields from code (as I do in my real app when the validation of a form fails). The detail is displayed for the first TextField but not displayed for the second one.

Hope you'll get to find the bug, ask if you need anything else! Thx!

@daniel-jonathan
Copy link
Member

Thank you for this, I will take a look. I am currently working on both the Textview and TextField. I will follow up with your example and fix very soon :) I appreciate your help very much.

@daniel-jonathan
Copy link
Member

daniel-jonathan commented Nov 14, 2016

Fixed the issue :) This was a really good catch, thank you! I am pushing a release now with the fix along with some others, in Material 2.3.10.

Also, just incase, your app sample had an issue:

textFieldSomething.detail = "Error!"
textFieldSomething.detailColor = UIColor.red

textFieldSomething.detail = "Error!"
textFieldSomething.detailColor = UIColor.red

should be

textFieldSomething.detail = "Error!"
textFieldSomething.detailColor = UIColor.red

textFieldSomethingElse.detail = "Error!"
textFieldSomethingElse.detailColor = UIColor.red

Thank you :)

@balazsgerlei
Copy link
Author

balazsgerlei commented Nov 18, 2016

Hi! Thx for the fix, I verified and it indeed works now with the latest version. 👍

(An yes, what you found was a copy-paste bug in the sample project, the truth is that when I tried it I only used one TextView and only later added another one to demonstrate the original issue more clearly) 😄

@daniel-jonathan
Copy link
Member

No worries :) Thanks for you help.

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

No branches or pull requests

2 participants