-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
TextField looks drastically different after Swift rewrite #568
Comments
Have you looked at the Samples repo ? All the latest examples are there. Also, can you share some code ? |
I did but it wasn't exactly clear to me what it's purpose was. I opened the workspace and tried to run the "TextField" scheme and immediately got the build error Ah nevermind. Before I posted this I decided to sanity check one more time and see that you need to go into the directory of the scheme you want to build and run Of course |
They should work with So let's go forward with some error messages you are getting and sample code. |
I have tired opening up both The former gives the The later gives a linker error which then displays Looking into the "Build Phases" I see |
What version of CocoaPods are you using ? |
1.1.1 Also I think this is a Xcode 8.1 issue. I converted the project to the "recommended settings" and it suddenly compiled. |
Okay, so that tackles that. What are the other issues ?
|
And like I suspected the TextField seems to be working fine in the sample app. There must be something we are doing differently in our code but it is just so bizarre because TextField worked perfect under Swift 2 and iOS 9. Could creating the TextField inside a nib make a difference? |
Also, you must have made a big jump. A lot of the components and underlying libraries were rewritten for Material 2. So I can help you catch up. It could, but shouldn't be an issue. At the end of the day, the TextField is a subclass of UITextField. What I think the issue is that the API has been updated and you are not setting the correct values. Do you mind sharing your setup code? Thank you! |
Sure but first let me prune out some code and make sure the problem is still occurring with the most basic of setup code. Should take me about 5 minutes. |
OK I have reduced the code to the absolute bare minimum and am still seeing the issue. Basically the scenario is as follows. I have a nib file for a UITableViewCell subclass. We add a label, a button and two text fields to the content view. Inside the
and that's it. Other than the fact that the text fields are created inside the nibs (or that they are inside a table view cell) everything looks normal. I think I'll go and create a quick view controller that adds text fields to it programmatically and see if I have any better luck. Oh and I just want to reiterate that I changed nothing about this nib and custom cell class during the Swift 2 to 3 migration other than the changes the migrator made which look benign. |
I can see API issues that you have in your code, such as dividerColor should be dividerNormalColor. If you create a sample project I can help you from there. Send it to [email protected]. |
So I created a quick view controller, programmatically created a
This occurs in the sample app as well. Go into the
|
I really need code to see what you are doing. Please share the sample app. |
@DanielDahan I have no sample app to share. I've just been working with a scrap piece of code like:
and playing with the innards of the So far I think the only bug is setting The other issue which I am not confident is a bug is the fact that the placeholder label is now laid out in a different spot. Did that get changed during the Swift 3 migration? |
Below are some screenshots and the code used to generate them. You can see when you set the text to nil then the placeholder label disappears. In the Swift 2 days this code would generate the same screenshot.
|
Okay, I will need to review this. I notice you are using API calls that I have not necessarily mapped out. I will need to double check. Thank you for bringing this to our attention. |
@DanielDahan no problem. I'll update the code for the screenshots above so they don't use the |
@reidmain possibly update them, but leave the ones you are using commented out. I can then make sure it all works and ship an update :) I have one coming up. |
@DanielDahan don't worry I know our extension on TextField is busted and needs to be updated so I'm not gonna try to salvage it. For me the only real concerns are setting the |
@reidmain cool :) |
Actually @DanielDahan could you confirm something for me? I would expect |
It should be the former, where the colors correspond to the different states. |
It should, I will look into it. I will make this issue as a bug. |
I'm now confident that the placement of the placeholder label is also a bug. Say you have a textfield whose top is flush with the bottom of some other view, the placeholder label will now overlap that other view. You'd have to put padding into between the text field and the other view and that padding would need to be a function of the height of the text field which, in my opinion, is not ideal. Your text field should be sized such that it is the right bounds to contain all of it elements that it could be displaying. |
@DanielDahan totally understand. It's not blocking anything on our end at this moment. We put in some workarounds and the second you have a release out we'll update. |
Perfect! |
I am relating an issue that came in #576 Let's tackle this today :) I will post to development a proposed fix, and if possible, please test. |
Sure, I'll test it this evening or tomorrow :) (GMT+2 here ;)) |
Adding this as well #582 |
Adding this as well #583 |
Adding this as well CosmicMind/Samples#15 |
@DanielDahan I'll update to the development branch and report back after all of our tests have run. |
Looks good from my end. The placeholder text field shows if nil is set and the placeholder text is coloured properly when in the active state. |
Oh sorry I noticed one issue. If you become active and type in some text it works fine. The divider line and placeholder text are the active color. But if you move to the inactive state and then back to the active the placeholder text is the current color but the divider line is not. |
@reidmain I will check this scenario out within an hour :) |
@reidmain Sorry, I got majorly sidetracked with an issue I am looking at for Material. I will have to look into this more tomorrow. |
@DanielDahan no rush man. We already shipped a release with the workarounds I detailed and tomorrow we should be preparing a release with the 2.3.3 version. Everything is solid. |
@reidmain amazing :) Thank you |
I tired reproducing this after I made some updates. I am basically tabbing to different fields and all seems well. I am going to make a release now with some updates. Please test this out and let me know :) Thanks buddy! |
Your app looks pretty :) All seems to be working for me. Do you mind showing me your latest setup code? |
Your "all seems to be working for me" made me go back and double check and I realized that this table view cell is a unique case. In another scenario (where we are taking in a credit card number) the text fields seem to be working as intended. I suspect that in the delegate methods of UITextField we are doing something strange that is confusing the state of TextField. I will delve deeper and report back if I think there is anything TextField is doing but at this point in time it looks to be working as intended. Thank you very much for all your hard work. |
Thank you, and if you can, even privately at [email protected], you can share code with me on the setup and I can help :) |
I just updated Material library in our App (it's been a while since we haven't updated), and also noticed the placeholder label was positioning higher than before (overlapping with some other elements in some cases). Reverting line 574 to use frame instead of bounds fixes this issue. |
@DanielDahan I created a fork to fix this issue so it works as before in our App. Let me know if you want me to send a pull request. |
@jbaez what was the issue? I understand it doesn't work like before, but that may a settings change that is needed. Can you send a PR, I'd be happy to review it. Thank you! |
@DanielDahan and @jbaez I created a separate issue for this. #1092 |
I am in the process of updating our app to use Swift 3 and Material is one of the dependencies I've had to update. I am using release 2.2.5.
There are three big issues I am seeing:
Placeholder text does not appear until some text is entered into the text field.
placeholderActiveColor is being ignored. The color of the placeholder text does not change if the text field becomes the first responder.
The placeholder label now appears to be in a different position. We use snapshot tests to ensure our UI does not change accidentally and all of our uses of Material's TextField seem to have the placeholder label shift up by about 20 pixels.
I am currently using Xcode 8.1 GM and building against the iOS 10 SDK.
I will continue to investigate to try and figure out what the issue could be. These seem like core components of the TextField so I have to imagine it isn't behaving like this for everyone but looking at our code we are not doing anything unique with our text fields.
The text was updated successfully, but these errors were encountered: