youjinp / SwiftUIKit

A collection of missing SwiftUI components
MIT License
278 stars 32 forks source link

CurrencyTextField ignores RoundedBorderTextFieldStyle #14

Open PlasmaSoftUK opened 4 years ago

PlasmaSoftUK commented 4 years ago

Sorry, me again, it seems that its not possible to apply this setting to the Currency Text Field:

.textFieldStyle(RoundedBorderTextFieldStyle())

When I add this option nothing about the text field appearance changes, it is in a view with other normal TextFields and so I would like it to be styled the same. I can get close to the effect I am wanting using this:

.foregroundColor(Color.black)
.background(Color.white)
.cornerRadius(12)

This gives a white background with black text and rounded corners, but just like a normal TextField when viewing in Dark Mode it's all black as it ignores the white background. So the above styling option would fix that but doesn't work.

Kind Regards

Plasma

youjinp commented 4 years ago

That's right. CurrencyTextField is a wrapper around UITextField so it is not possible to apply SwiftUI's modifiers and extensions.

You can do this, however, to get the same effect

CurrencyTextField(..., foregroundColor: UIColor.black, ...)
    .background(Color.white)
    .cornerRadius(12)