Ionic-Android 10+上的文本输入未回显

问题描述 投票:1回答:1

在Android 10上运行时,我的Ionic应用程序遇到了最特殊的错误。

附带的gif应该可以总结出什么问题,但是我可以说它在版本低于10的Android设备上可以正常工作。

基本上,除非我点击了一些视觉分隔符(即空格),否则任何实际输入都不会回显到屏幕上。它几乎适用于应用程序中的每个文本输入,但登录屏幕应足以了解该想法。

Android 10设备上的文本输入:

“”

并且还要提供一些代码,这将是受影响的登录代码段。

<ion-content no-bounce id="login-content">
  <img
    src="assets/logo/datenpool-logo-blue.svg"
    alt="datenpool-logo"
    title="datenpool-logo"
    id="datenpool-logo"
  />
  <form [formGroup]="loginForm">
    <div fxLayout="column" fxLayoutAlign="center center">
      <ion-input
        placeholder="{{ 'authentication.login.form.username' | translate }}"
        type="text"
        formControlName="username"
        [formControl]="loginForm.controls['username']"
        required
      ></ion-input>
      <ion-input
        placeholder="{{ 'authentication.login.form.password' | translate }}"
        type="password"
        formControlName="password"
        [formControl]="loginForm.controls['password']"
        required
      ></ion-input>
      <mat-error *ngIf="isInvalid">
        {{ error }}
      </mat-error>
      <button
        (click)="login()"
        type="submit"
        [disabled]="!loginForm.valid"
        class="button"
      >
        {{ 'authentication.login.form.button' | translate }}
      </button>
    </div>
  </form>
  <div fxLayoutAlign="center center">
    <button (click)="forgotPassword()" class="forgotpw">
      {{ 'authentication.login.forgot-password' | translate }}
    </button>
  </div>
</ion-content>

我个人怀疑代码是否有错误,而是与Android及其预测文本功能有关。无论如何,我希望有人能指出我正确的方向。预先感谢,各位。

android ionic-framework textinput
1个回答
0
投票
我设法找到问题背后的原因。

我没有提到的是该项目正在使用电容器。并且由于该原因,存在capacitor.config.json。在该JSON文件中,有一个专用的android块,具有以下属性:

"android": { "backgroundColor": "#ffffffff", "allowMixedContent": true, "captureInput": false, "webContentsDebuggingEnabled": true },

发生的事情是captureInput设置为true。 

captureInput的作用是用一个更简单的键盘替换标准的Android键盘,从而使开发人员可以更轻松地使用键捕获事件。

显然,它的作用还在于实际上使Android 10上的文本输入变得无用。
© www.soinside.com 2019 - 2024. All rights reserved.