[TIMOB-23615] Windows: Problem adding eventlistener twice to Ti.UI.ImageView
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2016-07-06T02:34:22.000+0000 |
Affected Version/s | Release 5.4.0 |
Fix Version/s | Release 5.4.0 |
Components | Windows |
Labels | n/a |
Reporter | Jonas Bjurhult |
Assignee | Gary Mathews |
Created | 2016-06-17T08:45:27.000+0000 |
Updated | 2016-07-06T15:52:49.000+0000 |
Description
1. Add eventListener to ImageView
2. Click ImageView
3. Remove eventListener
4. Add same eventListener again.
5. Click ImageView
6. Notice that the last click event will not be fired
index.xml
<Alloy>
<Window class="container" id="win">
<Label id="label" onClick="doClick">Hello, World</Label>
</Window>
</Alloy>
index.js
var imgview = Ti.UI.createImageView({height:100, width:100, image:'images/nav_backicon.png', top:10});
$.win.add(imgview);
imgview.addEventListener('click', clickListener);
Ti.API.info("added listener 1");
function clickListener(e) {
alert("clicked");
imgview.removeEventListener('click', clickListener);
setTimeout(function () {
imgview.addEventListener('click', clickListener);
Ti.API.info("added listener 2");
}, 2000);
}
$.win.open();
Attachments
File | Date | Size |
---|---|---|
nav_backicon.png | 2016-06-17T08:45:18.000+0000 | 353 |
I can reproduce the behaviour described on: Windows 10 Pro Ti SDK: 5.3.0.GA, 5.4.0.v20160704082523 Appc NPM: 4.2.7-2 Appc CLI: 5.4.0-26 Appc Studio: 4.7.0.201606220541
https://github.com/appcelerator/titanium_mobile_windows/pull/768 https://github.com/appcelerator/titanium_mobile_windows/pull/769
Pushing this to 5.4.0 because it's critical.
Verified using: Windows 10 Pro Ti SDK: 5.4.0.v20160705213725 Appc NPM: 4.2.7-2 Appc CLI: 5.4.0-26 Appc Studio: 4.7.0.201606220541 Lumia 930: 10.0 Lumia 520 : 8.1 The code sample attached now works as expected. Closing ticket