handle prop changes for both children and root views

This commit is contained in:
Hailey
2024-01-17 11:17:36 -08:00
parent d906fe4fcf
commit 340b84f053
3 changed files with 10 additions and 7 deletions
@@ -54,9 +54,11 @@ class ExpoUITextView: ExpoView {
// Do the same whenever subviews are removed
override func removeReactSubview(_ subview: UIView!) {
if subview.isKind(of: ExpoUITextViewChild.self) {
subview.removeFromSuperview()
}
subview.removeFromSuperview()
}
override func didSetProps(_ changedProps: [String]!) {
self.getTextChildren()
}
// Just return the subviews
@@ -4,4 +4,9 @@ class ExpoUITextViewChild: ExpoView {
var text: String?
var style: TextStyle?
let onTextPress = EventDispatcher()
override func didSetProps(_ changedProps: [String]!) {
let superview = self.superview as? ExpoUITextView
superview?.setText()
}
}
@@ -36,10 +36,6 @@ public class ExpoUITextViewModule: Module {
}
Prop("numberOfLines") { (view: ExpoUITextView, prop: Int?) in
view.textView.textContainer.maximumNumberOfLines = prop ?? 0
if view.textView.attributedText != nil {
view.setText()
}
}
Prop("ellipsizeMode") { (view: ExpoUITextView, prop: EllipsizeMode) in
view.textView.textContainer.lineBreakMode = prop.toLineBreakMode()