Ion-textarea autosize component not working in --prod mode


Hello Guys,

Please help me, I have implemented Ion-textarea auto grow custom component. when running in web on 'ionic serve ’ command it is working better but when executed ‘ionic cordova run android --prod command’ doesn’t work in mobile or tab.


How did you implement the component?

Did you remote debug the problem on the device already? Follow these instructions here to debug the problem in Chrome dev tools: Look at the console and network tabs for errors.


this is the code of custom component bellow

auto-size.ts file

import { ElementRef, HostListener, Directive, OnInit } from '@angular/core';

	selector: 'ion-textarea[autosize]'
export class AutosizeTextAreaComponent {
	@HostListener('input', ['$'])
	onInput(textArea: HTMLTextAreaElement): void {

	constructor(public element: ElementRef) {

	ngOnInit(): void {
		setTimeout(() => this.adjust(), 0);

	adjust(): void {
		let ta = this.element.nativeElement.querySelector("textarea"); = "hidden"; = "auto"; = ta.scrollHeight + "px";


demo.html page

<ion-textarea  type="text" autosize rows="1" (keypress)="_lengthKeyPress($event)" formControlName="g11" [(ngModel)]="obj.g11"></ion-textarea>

It is working on mobile when executed ionic cordova run android but not working in ionic cordova run android --prod command.


When executed ionic cordova run android textarea autogrow working fine but not working
on this ionic cordova run android --prod command.

Please help me…


I can only repeat my question:


Try this its a simple method no need to import third libraries
I found this method on ionic framework

<ion-textarea (input)=“adjustTextarea($event);” >
and on ts file write this code and enjoy !
protected adjustTextarea(event: any): void {
let textarea: any =; = ‘hidden’; = ‘auto’; = textarea.scrollHeight + ‘px’;