Ensure that isEnabled only triggers when false. Preventing isEnabled from changing isON.

This commit is contained in:
Kevin G Christiano 2020-01-08 11:03:44 -05:00
parent 14f49882b1
commit dfa2fa3343

View File

@ -61,7 +61,7 @@ public typealias ActionBlockConfirmation = () -> (Bool)
open override var isEnabled: Bool { open override var isEnabled: Bool {
didSet { didSet {
isUserInteractionEnabled = isEnabled isUserInteractionEnabled = isEnabled
changeStateNoAnimation(isEnabled) changeStateNoAnimation(isEnabled ? isOn : false)
backgroundColor = isEnabled ? containerTintColor?.off : disabledTintColor?.container backgroundColor = isEnabled ? containerTintColor?.off : disabledTintColor?.container
knobView.backgroundColor = isEnabled ? knobTintColor?.off : disabledTintColor?.knob knobView.backgroundColor = isEnabled ? knobTintColor?.off : disabledTintColor?.knob
} }
@ -398,6 +398,10 @@ extension Toggle {
if let isAnimated = dictionary["isAnimated"] as? Bool { if let isAnimated = dictionary["isAnimated"] as? Bool {
self.isAnimated = isAnimated self.isAnimated = isAnimated
} }
if let isEnabled = dictionary["isEnabled"] as? Bool{//}, !isEnabled {
self.isEnabled = isEnabled
}
} }
public class func estimatedHeight(forRow json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat { public class func estimatedHeight(forRow json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat {