Skip to content

[TNS 3.0] Android: Pressing ENTER key from hardware keyboard in TextView throws an exception #4123

@PeterStaev

Description

@PeterStaev

This was tested on stock android emulators API 23, inside a TextView widget if you press Enter key on the keybaord (which my guess emulates the press of an Enter key on a hardware keyboard on a real device) throws the below mentioned error. Problem is this line where the call to _onReturnPress() is which is not implemented by the TextView widget due to incorrect typings in the d.ts file of EditableTextBase

An uncaught Exception occurred on "main" thread.
com.tns.NativeScriptException:
Calling js method onEditorAction failed
TypeError: owner._onReturnPress is not a function
File: "file:///data/data/com.comforcare.hm4.caregiverapp/files/app/tns_modules/tns-core-modules/ui/editable-text-base/editable-text-base.js, line: 77, column: 22
StackTrace:
Frame: function:'EditTextListenersImpl.onEditorAction', file:'file:///data/data/com.comforcare.hm4.caregiverapp/files/app/tns_modules/tns-core-modules/ui/editable-text-base/editable-text-base.js', line: 77, column: 23
at com.tns.Runtime.callJSMethodNative(Native Method)
at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1021)
at com.tns.Runtime.callJSMethodImpl(Runtime.java:903)
at com.tns.Runtime.callJSMethod(Runtime.java:890)
at com.tns.Runtime.callJSMethod(Runtime.java:874)
at com.tns.Runtime.callJSMethod(Runtime.java:866)
at com.tns.gen.java.lang.Object_frnal_ts_helpers_l58_c38__EditTextListenersImpl.onEditorAction(Object_frnal_ts_helpers_l58_c38__EditTextListenersImpl.java:45)
at android.widget.TextView.doKeyDown(TextView.java:6030)
at android.widget.TextView.onKeyDown(TextView.java:5911)
at android.view.KeyEvent.dispatch(KeyEvent.java:2640)
at android.view.View.dispatchKeyEvent(View.java:9234)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1640)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1640)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1640)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1640)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1640)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1640)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1640)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1640)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1640)
at com.android.internal.policy.PhoneWindow$DecorView.superDispatchKeyEvent(PhoneWindow.java:2395)
at com.android.internal.policy.PhoneWindow.superDispatchKeyEvent(PhoneWindow.java:1727)
at android.app.Activity.dispatchKeyEvent(Activity.java:2725)
at com.android.internal.policy.PhoneWindow$DecorView.dispatchKeyEvent(PhoneWindow.java:2310)
at android.view.ViewRootImpl$ViewPostImeInputStage.processKeyEvent(ViewRootImpl.java:4127)
at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4089)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3642)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3695)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3661)
at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:3787)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3669)
at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:3844)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3642)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3695)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3661)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3669)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3642)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3695)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3661)
at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:3820)
at android.view.ViewRootImpl$ImeInputStage.onFinishedInputEvent(ViewRootImpl.java:3981)
at android.view.inputmethod.InputMethodManager$PendingEvent.run(InputMethodManager.java:2253)
at android.view.inputmethod.InputMethodManager.invokeFinishedInputEventCallback(InputMethodManager.java:1874)
at android.view.inputmethod.InputMethodManager.finishedInputEvent(InputMethodManager.java:1865)
at android.view.inputmethod.InputMethodManager$ImeInputEventSender.onInputEventFinished(InputMethodManager.java:2230)
at android.view.InputEventSender.dispatchInputEventFinished(InputEventSender.java:141)
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:323)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions