From 790cda6a20dacd9a6fc7b7ff8a800d21513aa78a Mon Sep 17 00:00:00 2001 From: jsdevlover Date: Mon, 16 Nov 2015 00:33:07 +0530 Subject: [PATCH 1/2] Soft keyboard now opens on first tap and cursor is positioned correctly. --- src/platforms/native/EditText.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/platforms/native/EditText.js b/src/platforms/native/EditText.js index 202f6173..20f3682c 100644 --- a/src/platforms/native/EditText.js +++ b/src/platforms/native/EditText.js @@ -116,7 +116,9 @@ exports = Class(function() { if (this._opts.closeOnDone === false) { closeOnDone = false; } - + //Makes sure soft keyboard is opened on first tap. + NATIVE.call('softKeyboard.open', {}); + NATIVE.call('editText.focus', { id: this._id, paddingLeft: this._opts.paddingLeft * scale, @@ -139,8 +141,11 @@ exports = Class(function() { hasForward: hasForward, closeOnDone: closeOnDone }); - - //cursorPos); + //FIXME HACK: cursorPos property above doesn't seem to set the cursor position correctly. + //This sets the cursor at the last position if TextEditView contains some text while focussing. + NATIVE.call('editText.setText', { + text: currentVal + }); } this.hasFocus = function() { From 7cd40ff70c16dc2a5025c445ce399cb42974ce0a Mon Sep 17 00:00:00 2001 From: jsdevlover Date: Mon, 16 Nov 2015 00:45:35 +0530 Subject: [PATCH 2/2] Corrected typo. --- src/platforms/native/EditText.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/platforms/native/EditText.js b/src/platforms/native/EditText.js index 20f3682c..92911465 100644 --- a/src/platforms/native/EditText.js +++ b/src/platforms/native/EditText.js @@ -142,7 +142,7 @@ exports = Class(function() { closeOnDone: closeOnDone }); //FIXME HACK: cursorPos property above doesn't seem to set the cursor position correctly. - //This sets the cursor at the last position if TextEditView contains some text while focussing. + //This sets the cursor at the last position if TextEditView contains some text while focusing. NATIVE.call('editText.setText', { text: currentVal });