Skip to content

Commit 23dc84d

Browse files
manoldonevSvetoslavTsenov
authored andcommitted
fix(ios): textview content clipped on every other newline (#6864)
1 parent 603c901 commit 23dc84d

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

tns-core-modules/ui/text-view/text-view.ios.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,16 @@ class UITextViewDelegateImpl extends NSObject implements UITextViewDelegate {
9595
}
9696
}
9797

98+
class NoScrollAnimationUITextView extends UITextView {
99+
// see https://github.com/NativeScript/NativeScript/issues/6863
100+
// UITextView internally scrolls the text you are currently typing to visible when newline character
101+
// is typed but the scroll animation is not needed because at the same time we are expanding
102+
// the textview (setting its frame)
103+
public setContentOffsetAnimated(contentOffset: CGPoint, animated: boolean): void {
104+
super.setContentOffsetAnimated(contentOffset, false);
105+
}
106+
}
107+
98108
@CSSType("TextView")
99109
export class TextView extends EditableTextBase implements TextViewDefinition {
100110
nativeViewProtected: UITextView;
@@ -103,7 +113,7 @@ export class TextView extends EditableTextBase implements TextViewDefinition {
103113
public _isEditing: boolean;
104114

105115
createNativeView() {
106-
const textView = UITextView.new();
116+
const textView = NoScrollAnimationUITextView.new();
107117
if (!textView.font) {
108118
textView.font = UIFont.systemFontOfSize(12);
109119
}

0 commit comments

Comments
 (0)