Titanium JIRA Archive
Appcelerator Community (AC)

[AC-5553] Android: TextField do not fire touch events

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionDuplicate
Resolution Date2018-02-08T04:53:06.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsTitanium SDK & CLI
Labelsandroid, click, textfield, touch
ReporterSandro Lain
AssigneeShak Hossain
Created2018-01-26T14:10:54.000+0000
Updated2018-02-08T04:53:06.000+0000

Description

TextField View on Android does not fire "click", "singletap", "doubletap", ... Events are not fired even with editable = false If TextField is set with touchEnable = false, events do not pass to the parent, no events are fired Example code:

var cnt = $.UI.create("View", {
	backgroundColor: "#FF0000",
	height:Ti.UI.SIZE,
	top: 100
});

var tf = $.UI.create('TextField', {
	height: 40,
	backgroundColor: "#FFFFFF",
	borderWidth: 1, borderColor: "#000000",
	left: 40,
	right: 40,
	top: 40,
	bottom: 40,
	editable: false,
	touchEnabled: false
});

// Event on the parent element that emit the click event if directly touched
cnt.addEventListener("click", function()
{
	alert('Click CNT OK');
});

tf.addEventListener("click", function()
{
	alert('Click TF OK');
});

tf.addEventListener("singletap", function()
{
	alert('SingleTap TF OK');
});

tf.addEventListener("doubletap", function()
{
	alert('DoubleTap TF OK');
});

tf.addEventListener("longpress", function()
{
	alert('LongPress TF OK');
});


cnt.add(tf);
$.win.add(cnt);


$.win.open();

Comments

  1. Sandro Lain 2018-01-26

    Hello with SDK 7.0.1 click events do not occur even if touchEnabled = true and editable = true, virtually never With touchEnabled = false, click not bubble to parent Initially i tried to set editable = false to check if click events are fired
  2. Sharif AbuDarda 2018-01-26

    Hello, I wasn't able to reproducible the issue with your sample code, The click event in the view does fire. But the rest of the event does not since it's for the textfield and where "editable: false, and touchEnabled: false. Thanks.
  3. Sandro Lain 2018-01-30

    Click events on TextField are never fired (even with the following code). Also with *touchEnabled: false* the event does not pass to the parent view.
       var tf = $.UI.create('TextField', {
       	height: 40,
       	backgroundColor: "#FFFFFF",
       	borderWidth: 1, borderColor: "#000000",
       	left: 40,
       	right: 40,
       	top: 40,
       	bottom: 40
       });
       
  4. Sharif AbuDarda 2018-01-30

    Hello [~sandrolain], Thanks for your reply, According to [docs](http://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.TextField-property-touchEnabled) with touchEnabled: false the event forward to peers, not to parents. Anyway, I was able to reproduce the issue for click event in textfield with the below code
       var win = Ti.UI.createWindow({
         backgroundColor: 'white'
       });
       
       var textField = Ti.UI.createTextField({
         borderStyle: Ti.UI.INPUT_BORDERSTYLE_ROUNDED,
         color: '#336699',
         top: 10, left: 10,
         width: 250, height: 60
       });
       
       textField.addEventListener("click", function()
       {
       	alert('Click TF OK');
       });
       
       win.add(textField);
       win.open();
       
    There is an issue with click event in textfield, Moving to TIMOB. Thanks.
  5. Motiur Rahman 2018-02-08

JSON Source