Autofocus Not working

  <ion-input
    class="container__input"
    [autofocus]="focus"
    type="text"
    id="tagId"
    name="tagId"
    expand="full"
    placeholder="code"
    [(ngModel)]="tagId"
    (input)="calculateByteLength($event)"
  />
  <ion-input
    class="container__input"
    autofocus="true"
    type="text"
    id="tagId"
    name="tagId"
    expand="full"
    placeholder=" code"
    [(ngModel)]="tagId"
    (input)="calculateByteLength($event)"
  />

auto focus not working
Any solution