Skip to content

Android editable text base needs better defaults for controlling closing keyboard #4858

@evanfuture

Description

@evanfuture

Did you verify this is a real problem by searching [Stack Overflow]

Yes

Tell us about the problem

Android editable text base needs better defaults for controlling closing keyboard

Which platform(s) does your issue occur on?

Android

Please provide the following version numbers that your issue occurs with:

  • CLI: 3.1.0
  • Cross-platform modules: 3.1.0
  • Runtime(s): tns-android 3.1.1

Please tell us how to recreate the issue in as much detail as possible.

When a TextView uses the Send action, the keyboard will always close. This is because there is nothing to handle this specific case in the onEditorAction method in https://github.com/NativeScript/NativeScript/blob/master/tns-core-modules/ui/editable-text-base/editable-text-base.android.ts#L99

In that method, the default is to return false. Based on the android documentation, we should return true if we have consumed the action, else false.

In other words, if we're done using the keyboard, return false, otherwise return true.

In this particular case then (pressing the Send button), we are forcing the keyboard to close instead of letting the developer handle this.

Is there code involved? If so, please share the minimal amount of code needed to recreate the problem.

To reproduce this, create a textfield with a returnKeyType of send...
this._input.returnKeyType = 'send';

And try something like focusing the input during its returnPress method.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions