[SOLVED] Ion-textarea resize height dynamically

To make resizing work for deleting text, I added a line to the resize method that first sets the textarea height to auto, and then does the resize based on scroll height. This clears the height and then recomputes as the user types. Seems to work for me even when the delete button is held down, and does not seem to introduce any visual glitches. (I haven’t tested across devices, only on my iPhone). My revised method looks like this:

  resize() {
    this.myInput.nativeElement.style.height = 'auto'
    this.myInput.nativeElement.style.height = this.myInput.nativeElement.scrollHeight + 'px';
  }
4 Likes