I am trying to create a simple chat in nativescript-angular. On Android everything works fine, however on IOS I have this strange bug, where if the user inputs multiple lines into the textview, the textview does not return to the original state, after the message was sent.
The height of the textview is set to "auto", which is needed to have dynamic sizing for the Textview.
When the user clicks the "send" button, the textview should resize to the original size. However it stays the old height. On Android the TextView resizes perfectly..
This is my TextView:
<TextView #textView row="1" column="0" textWrap="true" lineHeight="4" height="auto"
[(text)]="message" (textChange)="onTextChange($event)" class="text-view" ></TextView>
And in my typescript i just set this.message = '';
which works fine enough on Android.
Any suggestions on how to make the TextView resize on IOS? I tried it with accessing the native element and set the height to auto again:
this.textView.nativeElement.height = "auto";
height is a PercentLength Property, and auto is a valid value, however it has no impact. It works if i set it to an absolute number, but I want to avoid that.
Thanks!
iOS doesn't re-layout upon text change, you may force re-layout with following code.
this.textView.nativeElement.requestLayout();