handle prop changes for both children and root views
This commit is contained in:
@@ -54,9 +54,11 @@ class ExpoUITextView: ExpoView {
|
|||||||
|
|
||||||
// Do the same whenever subviews are removed
|
// Do the same whenever subviews are removed
|
||||||
override func removeReactSubview(_ subview: UIView!) {
|
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
|
// Just return the subviews
|
||||||
|
|||||||
@@ -4,4 +4,9 @@ class ExpoUITextViewChild: ExpoView {
|
|||||||
var text: String?
|
var text: String?
|
||||||
var style: TextStyle?
|
var style: TextStyle?
|
||||||
let onTextPress = EventDispatcher()
|
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
|
Prop("numberOfLines") { (view: ExpoUITextView, prop: Int?) in
|
||||||
view.textView.textContainer.maximumNumberOfLines = prop ?? 0
|
view.textView.textContainer.maximumNumberOfLines = prop ?? 0
|
||||||
|
|
||||||
if view.textView.attributedText != nil {
|
|
||||||
view.setText()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Prop("ellipsizeMode") { (view: ExpoUITextView, prop: EllipsizeMode) in
|
Prop("ellipsizeMode") { (view: ExpoUITextView, prop: EllipsizeMode) in
|
||||||
view.textView.textContainer.lineBreakMode = prop.toLineBreakMode()
|
view.textView.textContainer.lineBreakMode = prop.toLineBreakMode()
|
||||||
|
|||||||
Reference in New Issue
Block a user