When attempting to create a chat view in Nativescript Javascript, I encountered an issue. After pressing the "Send" button on the keyboard, the message is sent; however, there is a strange behavior where the first 'enter' press on the keyboard is not registered. I have to click it again to send the initial message.
The problem only occurs with the first message. I need to double-click, and after that, it sends single messages with each click as intended, while keeping the keyboard open.
I am facing an issue with the following code snippet:
const page = args.object;
testingText = page.getViewById("chatText");
testingText.focus();
if(testingText.android)
{
console.log("PAST IF");
testingText.android.setOnEditorActionListener(new
android.widget.TextView.OnEditorActionListener({
onEditorAction: function (callbackType, result){
console.log("PAST IF");
if(result==android.view.inputmethod.EditorInfo.IME_ACTION_SEND){
console.log("WORKING");
console.log("CALL BACK " + callbackType)
}
console.log("CALL BACK " + callbackType);
return true;
}
}));
console.log("CALL BACK ");
}
If anyone has any insights or solutions to this issue, your help would be greatly appreciated. I am currently puzzled by why this behavior is occurring.