{ "id": "82595", "key": "AC-2738", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "12217", "key": "AC", "name": "Appcelerator - INBOX", "projectCategory": { "id": "10000", "description": "", "name": "Customer Service" } }, "resolution": { "id": "8", "description": "", "name": "Needs more info" }, "resolutiondate": "2011-12-19T16:24:41.000+0000", "created": "2011-11-10T08:26:05.000+0000", "labels": [ "1.8.0", "eventlistener", "ios" ], "versions": [], "issuelinks": [], "assignee": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "updated": "2016-03-08T07:47:38.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "14548", "name": "Titanium SDK & CLI", "description": "Please enter tickets related to the MobileSDK here." } ], "description": "In the sample code below, there is a view under a label. An addEventListener has been added to the view. The view and the label are different sized.\r\n\r\nThe behaviour is different between Android and iOS: The log message is displayed twice on iOS log for one click on the view while it is only displayed once on android.\r\n\r\n{code:lang=javascript|title=app.js}\r\nvar element=Titanium.UI.createView({\r\n top:20,\r\n height:150,\r\n left:0,\r\n width:200,\r\n backgroundColor:'blue',\r\n //backgroundImage:Titanium.Filesystem.resourcesDirectory+imageFond,\r\n });\r\n \r\n var lblTxt1=Titanium.UI.createLabel({\r\n text:'mon label',\r\n color:'#FFF',\r\n font : {\r\n fontSize : 22,\r\n fontFamily : 'Helvetica Neue',\r\n },\r\n top:5,\r\n height:75,\r\n left:15,\r\n width:100,\r\n backgroundColor:'red',\r\n });\r\n element.add(lblTxt1);\r\n \r\n element.addEventListener('click', function(e){\r\n Titanium.API.info('addEventListener click sur element:'+e)\r\n });\r\n \r\n win.add(element);\r\n{code}\r\nThis behaviour is unpleasant because all the code in the eventListener is executed twice....", "attachment": [], "flagged": false, "summary": "addEventListener on supperposed elements fired twice on iOS, and once on andrdoid", "creator": { "name": "edomont", "key": "edomont", "displayName": "edouard omont", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "edomont", "key": "edomont", "displayName": "edouard omont", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "* SDK 1.8.*\r\n* 1.8.0.1.v20111109\r\n* ios 4.0\r\n\r\n", "comment": { "comments": [ { "id": "176257", "author": { "name": "marcoschierhorn", "key": "marcoschierhorn", "displayName": "Marco Schierhorn", "active": true, "timeZone": "Europe/Berlin" }, "body": "I have the same problem but on Android. I tried it with 1.8.0.1 RC, nighty build 1.8.0.1 and 1.9.0. An view inside a row. And one click fires it 3 times. Strange.\r\nIn the example below the click event handler (topStoryThumb.addEventListener('click'...) is executed 3 times. Am I missing something?\r\n\r\n{code:javascript} \r\nfunction clickOnTopStory(e)\r\n{\r\n if (typeof(Titanium.UI.currentWindow.subWin)=='undefined' || (typeof(Titanium.UI.currentWindow.subWin)!='undefined' && Titanium.UI.currentWindow.subWin.visible == false))\r\n {\r\n Titanium.App.fireEvent('show_indicator');\r\n Ti.API.error('topStory | clickOnTopStory clicked');\r\n Titanium.UI.currentWindow.subWin = window.createNewsEntry(e.source.link);\r\n }\r\n else\r\n {\r\n Ti.API.info('clickOnTopStory clicked !!');\r\n }\r\n}\r\n\r\nfunction createTopStoryContent(homeNewsOverviewContent)\r\n{\r\n var topStoryData = [];\r\n var imageCollection = [];\r\n var topStoryClick = [];\r\n\r\n for ( var i = 0; i < homeNewsOverviewContent.length; i++)\r\n {\r\n if (!!homeNewsOverviewContent[i].artikel || !!homeNewsOverviewContent[i].serie)\r\n {\r\n topContent = (!!homeNewsOverviewContent[i].serie) ? homeNewsOverviewContent[i].serie[0].artikel : homeNewsOverviewContent[i].artikel[0];\r\n\r\n Ti.API.error('topContent.headline = ' + topContent.headline);\r\n\r\n var topStoryView = Ti.UI.createView(\r\n {\r\n width : 320,\r\n height : 210,\r\n top : 11,\r\n left : 0,\r\n right : 0,\r\n backgroundColor : '#000',\r\n layout : 'vertical'\r\n });\r\n\r\n var topStoryThumb = Titanium.UI.createImageView(\r\n {\r\n left : 0,\r\n right : 0,\r\n top : 0,\r\n bottom : 0,\r\n link : topContent.link_nonactive,\r\n id : topContent.id,\r\n image: getBigTeaserImage(topContent.teaserimage),\r\n height: 160,\r\n width: 320,\r\n canScale: true,\r\n enableZoomControls: false\r\n });\r\n\r\n topStoryView.add(topStoryThumb);\r\n\r\n if (!!topContent.headline)\r\n {\r\n var topStoryLabelView = Ti.UI.createView(\r\n {\r\n height : 50,\r\n width : 320,\r\n right : 0,\r\n left : 0,\r\n backgroundColor : '#CD2F26'\r\n });\r\n\r\n var topStoryTextLabel = Titanium.UI.createLabel(\r\n {\r\n text : processHtml(topContent.headline),\r\n font :\r\n {\r\n fontSize : 16,\r\n fontFamily : 'Arial',\r\n fontWeight : 'bold'\r\n },\r\n textAlign : 'center',\r\n color : '#FFFFFF',\r\n height :30,\r\n left: 2,\r\n right: 2,\r\n top: 0,\r\n bottom: 0,\r\n width : 'auto'\r\n });\r\n\r\n if (Titanium.Platform.osname == 'android')\r\n {\r\n topStoryTextLabel.font.fontSize = 14;\r\n }\r\n\r\n topStoryLabelView.add(topStoryTextLabel);\r\n topStoryView.add(topStoryLabelView);\r\n }\r\n\r\n topStoryClick[i] = topStoryThumb.addEventListener('click', function() {\r\n Titanium.App.fireEvent('show_indicator');\r\n Ti.API.error('topStory | clickOnTopStory clicked');\r\n window.createNewsEntry(topContent.link_nonactive);\r\n });\r\n\r\n topStoryData.push(topStoryView);\r\n }\r\n }\r\n\r\n var topStoryViewScroll = Titanium.UI.createScrollableView(\r\n {\r\n views : topStoryData,\r\n showPagingControl : true,\r\n pagingControlHeight : 2,\r\n maxZoomScale : 1.0,\r\n currentPage : 0,\r\n width : 320,\r\n height: 210,\r\n left : 0,\r\n right:0,\r\n top : 0\r\n });\r\n\r\n // Push into the main rows\r\n var topStoryContent = Titanium.UI.createTableViewRow(\r\n {\r\n hasChild : false,\r\n height : 210,\r\n width : 320,\r\n left: 1,\r\n right: 1,\r\n className : 'topStoryContent',\r\n backgroundColor : '#000',\r\n borderColor: '#000',\r\n borderWidth: 0,\r\n backgroundSelectedColor: '#000'\r\n\r\n });\r\n\r\n var viewIndex = 0;\r\n var activeView = topStoryData[0];\r\n\r\n topStoryContent.add(topStoryViewScroll);\r\n return topStoryContent;\r\n}\r\n{code} ", "updateAuthor": { "name": "marcoschierhorn", "key": "marcoschierhorn", "displayName": "Marco Schierhorn", "active": true, "timeZone": "Europe/Berlin" }, "created": "2011-12-15T12:02:08.000+0000", "updated": "2011-12-15T12:02:08.000+0000" }, { "id": "176258", "author": { "name": "rborn", "key": "rborn", "displayName": "Dan Tamas", "active": true, "timeZone": "Europe/Berlin" }, "body": "add the event to the table and check \r\n{code}\r\nif ( e.source.is_topStoryThumb ) { //blah blah }\r\n{code}\r\n\r\nif course, set to topStoryThumb something like \r\n{code}\r\ntopStoryThumb.is_topStoryThumb = true;\r\n{code}", "updateAuthor": { "name": "rborn", "key": "rborn", "displayName": "Dan Tamas", "active": true, "timeZone": "Europe/Berlin" }, "created": "2011-12-15T12:15:37.000+0000", "updated": "2011-12-15T12:15:37.000+0000" }, { "id": "176312", "author": { "name": "marcoschierhorn", "key": "marcoschierhorn", "displayName": "Marco Schierhorn", "active": true, "timeZone": "Europe/Berlin" }, "body": "I have used a kind of a global variable (Titanium.App.top_story_news_opening). \r\nI ask for it in the click event function. If it's undefined or == false I open the window. \r\nInside the window I set Titanium.App.top_story_news_opening = false, when every view is built and visible. \r\nSeems to work too ;)\r\n\r\nBecause the problem is that the click event doesn't get fired from the table.\r\n\r\n{code:javascript} \r\nfunction clickOnTopStory(e)\r\n{\r\n if (typeof(Titanium.App.top_story_news_opening)=='undefined' || (typeof(Titanium.App.top_story_news_opening)!='undefined' && Titanium.App.top_story_news_opening == false))\r\n {\r\n Titanium.App.top_story_news_opening = true;\r\n Titanium.App.fireEvent('show_indicator');\r\n Ti.API.error('topStory | clickOnTopStory clicked');\r\n Titanium.UI.currentWindow.subWin = window.createNewsEntry(e.source.link);\r\n }\r\n}\r\n{code}", "updateAuthor": { "name": "marcoschierhorn", "key": "marcoschierhorn", "displayName": "Marco Schierhorn", "active": true, "timeZone": "Europe/Berlin" }, "created": "2011-12-16T00:48:03.000+0000", "updated": "2011-12-16T01:07:16.000+0000" }, { "id": "176612", "author": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "body": "Thank you for raising this ticket.\r\n\r\nIf you are able to provide all the information described in the [JIRA Ticket Checklist|http://wiki.appcelerator.org/display/guides/How+to+Submit+a+Bug+Report#HowtoSubmitaBugReport-JIRATicketChecklist] guidelines, *in the correct fields and using the right format*, I will be able to escalate it to the core team. Please click *edit* to amend the body of the ticket, rather than adding a comment.\r\n\r\nAlso, your test case needs to run without modification when pasted into a blank app.js.\r\n\r\nI will mark this resolved for now. Please reopen when the ticket is complete.\r\n\r\nThanks in advance.", "updateAuthor": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "created": "2011-12-19T16:24:13.000+0000", "updated": "2011-12-19T16:24:13.000+0000" }, { "id": "183575", "author": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "body": "Closing due to inactivity. If this issue still exists, please raise a new ticket, including all the information in the [JIRA Ticket Checklist|https://wiki.appcelerator.org/display/guides/How+to+Submit+a+Bug+Report#HowtoSubmitaBugReport-JIRATicketChecklist] to ensure that we can escalate it quickly. Read [How to Submit a Bug Report|https://wiki.appcelerator.org/display/guides/How+to+Submit+a+Bug+Report] if you have not read it before, and always start a ticket using the [JIRA Ticket Template|https://wiki.appcelerator.org/display/guides/JIRA+Ticket+Template].\r\n\r\nThanks in advance", "updateAuthor": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "created": "2012-02-17T02:23:15.000+0000", "updated": "2012-02-17T02:23:15.000+0000" } ], "maxResults": 5, "total": 5, "startAt": 0 } } }