This repository was archived by the owner on Dec 15, 2022. It is now read-only.
This repository was archived by the owner on Dec 15, 2022. It is now read-only.
LineHeight only applies correctly to the first input in ViewController #106
Open
Description
Hi!
I'm facing an issue with the lineHeight
when I have multiple AnimatedTextInput in the same ViewController. As you can see in the following screenshot, all style parameters are applied to all inputs correctly, except the line height parameter, which is only applied to the first one.
Code in ViewController (Called in viewDidLoad()
)
private func setupForm() {
let style = Style.SilenceTextInputStyle()
nameTextInput.placeHolderText = "SignUpName".localized
nameTextInput.style = style
nameTextInput.type = .standard
nameTextInput.returnKeyType = .next
nameTextInput.delegate = self
surnameTextInput.placeHolderText = "SignUpSurname".localized
surnameTextInput.style = style
surnameTextInput.type = .standard
surnameTextInput.returnKeyType = .next
surnameTextInput.delegate = self
phoneTextInput.placeHolderText = "SignUpMobile".localized
phoneTextInput.style = style
phoneTextInput.type = .phone
phoneTextInput.returnKeyType = .next
phoneTextInput.delegate = self
passwordTextInput.placeHolderText = "SignUpPassword".localized
passwordTextInput.style = style
passwordTextInput.type = .password(toggleable: true)
passwordTextInput.returnKeyType = .continue
passwordTextInput.delegate = self
}
They all have the exact same style SilenceTextInputStyle
extension Style {
struct SilenceTextInputStyle: AnimatedTextInputStyle {
let activeColor: UIColor = Color.inputActive
let placeholderInactiveColor: UIColor = Color.inputInactive
let inactiveColor: UIColor = Color.inputInactive
let lineInactiveColor: UIColor = Color.inputInactive
let lineActiveColor: UIColor = Color.inputActive
let lineHeight: CGFloat = 4.0
let errorColor: UIColor = Color.inputError
let textInputFont: UIFont = Font.with(name: .gothamHTFBook, size: 17)
let textInputFontColor: UIColor = Color.inputText
let placeholderMinFontSize: CGFloat = 11
let counterLabelFont: UIFont? = Font.with(name: .gothamHTFMedium, size: 11)
let leftMargin: CGFloat = 0
let topMargin: CGFloat = 20
let rightMargin: CGFloat = 0
let bottomMargin: CGFloat = 10
let yHintPositionOffset: CGFloat = 0
let yPlaceholderPositionOffset: CGFloat = 0
let textAttributes: [String : Any]? = nil
}
}
And lastly, here is a debugPrint of the style
property in the surnameTextInput
after style was setted: (The lineHeight is correct)
(lldb) po surnameTextInput.style
▿ SilenceTextInputStyle
- lineHeight : 4.0
- placeholderMinFontSize : 11.0
▿ counterLabelFont : Optional<UIFont>
- leftMargin : 0.0
- topMargin : 20.0
- rightMargin : 0.0
- bottomMargin : 10.0
- yHintPositionOffset : 0.0
- yPlaceholderPositionOffset : 0.0
- textAttributes : nil
I tried a couple things like:
- Create a
style
to be sure thatSilenceTextInputStyle
is being instantiate correctly. - I also dispatch on main queue
- Set higher height constraint numbers to each view.
No luck.
Hope you can help me,
Thanks!
Metadata
Metadata
Assignees
Labels
No labels