Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-6601] iOS: Touchstart event is not being listening on the right view.

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2012-01-23T17:00:53.000+0000
Affected Version/sRelease 1.7.5, Release 1.8.0, Release 1.8.0.1
Fix Version/sSprint 2011-51, Release 2.0.0, Release 1.8.1
ComponentsiOS
Labelsmodule_window, parity, qe-testadded
ReporterFrancisco Antonio Duran Ramirez
AssigneeVishal Duggal
Created2011-12-13T06:51:40.000+0000
Updated2014-06-19T12:43:30.000+0000

Description

Problem

Touchstart event is being listening for two views. The customer is listening the touchstart event of the parent view, but when he press the child view he got the touch event of the parent view, and child view.

Reproducible steps:

1. Run the code below 2. Click on the child view ( red square ) After pressing the child view ( red square ) you get the following outputs: [INFO] parent received TOUCHSTART event. Source: child [INFO] parent received TOUCHSTART event. Source: parent

Expected behavior:

The client wants to get the following output when he press the red button. [INFO] parent received TOUCHSTART event. Source: child

Tested with the next specs:

iPhone 3G Version: 4.3.5 iPAD 2 Version: 5 Simulator Titanium Studio, build: 1.0.7.201112080131 Titanium SDK: 1.8.0.1.RC1, 1.8.0.1.v20111205164258 & 1.7.5

More info:

With 1.7.5 Titanium SDK you get the correct expected behavior.

Sample code:

var win = Titanium.UI.createWindow({  
    backgroundColor:'#C08040',
    id: 'win'
});

function parentEventHandler(e) {
	Ti.API.info('parent received ' + e.type.toUpperCase() + ' event. Source: ' + e.source.id);	
}

var sampleParentView = Ti.UI.createView({
	bottom: 0, width: 100, height: 100, backgroundColor: 'yellow',
	id: 'parent'
});

var sampleChildView = Ti.UI.createView({
	width: 50, height: 50, backgroundColor: 'red',
	id: 'child'
});

//sampleParentView.addEventListener('click', parentEventHandler);
sampleParentView.addEventListener('touchstart', parentEventHandler);

sampleParentView.add(sampleChildView);
win.add(sampleParentView);

win.open();

Log Console:


[INFO] One moment, building ...
[INFO] Titanium SDK version: 1.8.0.1 (12/05/11 16:42 d54627f...)
[INFO] iPhone Device family: universal
[INFO] iPhone SDK version: 5.0
[INFO] iPhone simulated device: iphone
[INFO] Launching application in Simulator
[INFO] Launched application in Simulator (4.73 seconds)
[INFO] Found 5.0 patch installed
[INFO] Application started
[INFO] i13392/1.0 (1.8.0.1.v20111205164258.d54627f...)
[INFO] parent received TOUCHSTART event. Source: child
[INFO] parent received TOUCHSTART event. Source: parent

[INFO] One moment, building ...
[INFO] Titanium SDK version: 1.8.0.1 (12/09/11 16:48 531977c)
[INFO] iPhone Device family: universal
[INFO] iPhone SDK version: 5.0
[INFO] iPhone simulated device: iphone
[INFO] Performing full rebuild. This will take a little bit. Hold tight...
[INFO] Skipping JS compile, running from simulator
[INFO] Performing clean build
[INFO] Launching application in Simulator
[INFO] Launched application in Simulator (50.00 seconds)
[INFO] Found 5.0 patch installed
[INFO] Application started
[INFO] i13392/1.0 (1.8.0.1.RC1.531977c)
[INFO] parent received TOUCHSTART event. Source: child
[INFO] parent received TOUCHSTART event. Source: parent


[INFO] Titanium SDK version: 1.7.5
[INFO] iPhone Device family: universal
[INFO] iPhone SDK version: 5.0
[INFO] iPhone simulated device: iphone
[INFO] Performing full rebuild. This will take a little bit. Hold tight...
[INFO] Skipping JS compile, running from simulator
[INFO] Performing clean build
[INFO] Launching application in Simulator
[INFO] Launched application in Simulator (70.61 seconds)
[INFO] Found 5.0 patch installed
[INFO] Application started
[INFO] i13392/1.0 (1.7.5.ab20af7)
[INFO] parent received TOUCHSTART event. Source: child

Helpdesk

APP-796571

Comments

  1. Stephen Tramer 2011-12-20

    Not resolving until merged to 1.8.1.
  2. Natalie Huynh 2012-01-12

    Tested with 1.9.0.v20120112104633 with iPod 4.3.3

JSON Source