refactor to add resetAttributeStyle
This commit is contained in:
parent
2026d9171c
commit
a72f3cc3c1
@ -241,18 +241,7 @@ public typealias ActionBlock = () -> ()
|
|||||||
case left
|
case left
|
||||||
}
|
}
|
||||||
|
|
||||||
public func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject? = nil, _ additionalData: [AnyHashable: Any]? = nil) {
|
@objc public func resetAttributeStyle() {
|
||||||
|
|
||||||
clauses = []
|
|
||||||
text = nil
|
|
||||||
attributedText = nil
|
|
||||||
originalAttributedString = nil
|
|
||||||
shouldMaskWhileRecording = model.shouldMaskRecordedView ?? false
|
|
||||||
|
|
||||||
guard let labelModel = model as? LabelModel else { return }
|
|
||||||
|
|
||||||
text = labelModel.text
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is to address a reuse issue with iOS 13 and up.
|
* This is to address a reuse issue with iOS 13 and up.
|
||||||
* Even if you set text & attributedText to nil, the moment you set text with a value,
|
* Even if you set text & attributedText to nil, the moment you set text with a value,
|
||||||
@ -274,6 +263,21 @@ public typealias ActionBlock = () -> ()
|
|||||||
|
|
||||||
self.attributedText = attributedString
|
self.attributedText = attributedString
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject? = nil, _ additionalData: [AnyHashable: Any]? = nil) {
|
||||||
|
|
||||||
|
clauses = []
|
||||||
|
text = nil
|
||||||
|
attributedText = nil
|
||||||
|
originalAttributedString = nil
|
||||||
|
shouldMaskWhileRecording = model.shouldMaskRecordedView ?? false
|
||||||
|
|
||||||
|
guard let labelModel = model as? LabelModel else { return }
|
||||||
|
|
||||||
|
text = labelModel.text
|
||||||
|
|
||||||
|
resetAttributeStyle()
|
||||||
|
|
||||||
hero = labelModel.hero
|
hero = labelModel.hero
|
||||||
Label.setLabel(self, withHTML: labelModel.html)
|
Label.setLabel(self, withHTML: labelModel.html)
|
||||||
@ -786,10 +790,8 @@ public typealias ActionBlock = () -> ()
|
|||||||
extension Label {
|
extension Label {
|
||||||
|
|
||||||
public func reset() {
|
public func reset() {
|
||||||
//Weird issue. when cell reuse. text style is not getting reset.Fix for:CXTDT-344190
|
|
||||||
//We need to reset the attribute text first and then text. Its working fine
|
|
||||||
attributedText = nil
|
|
||||||
text = nil
|
text = nil
|
||||||
|
attributedText = nil
|
||||||
hero = nil
|
hero = nil
|
||||||
textAlignment = .left
|
textAlignment = .left
|
||||||
originalAttributedString = nil
|
originalAttributedString = nil
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user