Skip to content

Commit

Permalink
Merge pull request #1231 from OrkhanAlikhanov/storyboard-fix
Browse files Browse the repository at this point in the history
Storyboard hot fixes
  • Loading branch information
DanielDahan authored May 20, 2019
2 parents 3e26378 + ccaf29f commit a91a3e7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Sources/iOS/Button/Button.swift
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,9 @@ open class Button: UIButton, Pulseable, PulseableLayer, Themeable {
*/
public override init(frame: CGRect) {
super.init(frame: frame)
/// Set these here to avoid overriding storyboard values
tintColor = Color.blue.base
titleLabel?.font = Theme.font.regular(with: fontSize)
prepare()
}

Expand Down Expand Up @@ -274,7 +276,6 @@ open class Button: UIButton, Pulseable, PulseableLayer, Themeable {
*/
open func prepare() {
contentScaleFactor = Screen.scale
titleLabel?.font = Theme.font.regular(with: fontSize)
prepareVisualLayer()
preparePulse()
applyCurrentTheme()
Expand Down
6 changes: 5 additions & 1 deletion Sources/iOS/Text/TextField.swift
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,8 @@ open class TextField: UITextField, Themeable {
@IBInspectable
open var placeholderActiveColor = Color.blue.base {
didSet {
/// Keep tintColor update here. See #1229
tintColor = placeholderActiveColor
updatePlaceholderLabelColor()
}
}
Expand Down Expand Up @@ -397,6 +399,9 @@ open class TextField: UITextField, Themeable {
public override init(frame: CGRect) {
super.init(frame: frame)
prepare()

/// Fire didSet here to update tintColor
placeholderActiveColor = { placeholderActiveColor }()
}

open override func layoutSubviews() {
Expand Down Expand Up @@ -533,7 +538,6 @@ fileprivate extension TextField {

/// Updates the placeholderLabel text color.
func updatePlaceholderLabelColor() {
tintColor = placeholderActiveColor
placeholderLabel.textColor = isEditing ? placeholderActiveColor : placeholderNormalColor
}

Expand Down

0 comments on commit a91a3e7

Please sign in to comment.