How to get cursor position in Ionic 4?

In Ionic v3 I did something like this to get cursor position: for iOS textArea._native.nativeElement.selectionStart and for Android event.target.selectionStart but it seems like I cannot find selectionStart on elementRef.

I tried to access element using

@ViewChild('txArea', { read: ElementRef }) textArea: ElementRef;

and

  <ion-textarea
    #txArea
    [(ngModel)]="description"
    (keyup)="onKeyUp($event, txArea)"
    rows="4"
    autocorrect="on" autocomplete="on"
    placeholder="Enter description (i.e. @JoeDoe, #forehand)">
  </ion-textarea>

Can somebody help with this?

Thanks

Try to use autofocus in the input tag.

<ion-input autofocus></ion-input>

Another way to do it is:

In the HTML file put it:

<ion-input #input>

In the TS file do it:
export class LoginPage implements AfterViewInit {

  @ViewChild('input')  inputElement: IonInput;

  ngAfterViewInit() {
      setTimeout(() => {
         this.inputElement.setFocus();
    }, 400);
  }