diff --git a/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/editing/TextInputPlugin.ets b/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/editing/TextInputPlugin.ets index 2abc41a2a1838a3b2338f0d109dc39c761aa8e31..2d5c4ac2a3126a34a95acdfd54605be16dc2b005 100644 --- a/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/editing/TextInputPlugin.ets +++ b/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/editing/TextInputPlugin.ets @@ -164,7 +164,7 @@ class TextInputMethodHandlerImpl implements TextInputMethodHandler { } async updateAttribute(): Promise { - if (this.keyboardStatus == inputMethod.KeyboardStatus.HIDE) { + if (this.keyboardStatus != inputMethod.KeyboardStatus.SHOW) { return; } try { @@ -285,9 +285,6 @@ class TextInputMethodHandlerImpl implements TextInputMethodHandler { this.keyboardStatus = state; if (state == inputMethod.KeyboardStatus.HIDE) { this.plugin.textInputChannel.onConnectionClosed(this.inputTarget.id); - /// 收起软键盘时重置键盘状态,避免出现软键盘类型问题 - /// 系统对软键盘的改变也会被该方法监听到,如果继续使用使用detach和取消监听方法会导致其他问题,使用updateAttribute方法去重置,取消监听放在detach方法内,避免出现问题 - this.inputMethodController.updateAttribute({ textInputType: 0, enterKeyType: 1 }); } }