{ "id": "165163", "key": "TIMOB-24269", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [], "resolution": { "id": "5", "description": "All attempts at reproducing this issue failed, or not enough information was available to reproduce the issue. Reading the code produces no clues as to why this behavior would occur. If more information appears later, please reopen the issue.", "name": "Cannot Reproduce" }, "resolutiondate": "2019-12-06T18:13:28.000+0000", "created": "2017-01-03T11:10:33.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [ "alloy", "center", "opacity", "position", "visible" ], "versions": [ { "id": "18154", "name": "Release 6.0.1", "archived": false, "released": true, "releaseDate": "2016-12-21" }, { "id": "18322", "name": "Release 5.5.1", "archived": false, "released": true, "releaseDate": "2016-09-28" } ], "issuelinks": [], "assignee": null, "updated": "2019-12-06T18:13:28.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": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "I've 3 (loader, locker and debug view) hidden views (touchEnabled and visible set to false, and zIndex to 1) above the main view (zIndex = 2).\r\n\r\nEach 'over' view has this method:\r\n\r\n{code:java}\r\n$.debugView.show = function() {\r\n\r\n $.debugView.touchEnabled = $.debugView.visible = true;\r\n\r\n $.debugView.zIndex = 3;\r\n};\r\n\r\n$.debugView.hide = function() {\r\n\r\n $.debugView.touchEnabled = $.debugView.visible = false;\r\n\r\n $.debugView.zIndex = 1;\r\n};\r\n{code}\r\n\r\nThis screen has the 3 'over' views hidden:\r\n\r\n!https://i.stack.imgur.com/tIChk.png!\r\n\r\nNow, I'm opening the 'debug view', but, *SOMETIMES* it seems like it changes the positions (as if the center it's on the top left corner instead of the center of the device).\r\n\r\n!https://i.stack.imgur.com/uetQz.png!\r\n\r\nInstead of the required result:\r\n\r\n!https://i.stack.imgur.com/JkvK4.png!\r\n\r\nIf I use the opacity instead of the visible property, it works properly.\r\n\r\nThis might be an SDK bug right?\r\n\r\n\r\n{code:java}\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n{code}\r\n\r\nAll of these 4 views don't have width or height (so it uses the Ti.UI.FILL as default)\r\n\r\n*Rene Pot stackoverflow answer:*\r\n\r\n_I have noticed this too with a completely different implementation. I had just one view that I included in a window.\r\n\r\nApparently the left and top calculations were not done properly if the elements is hidden.\r\n\r\nWhat I did to solve the issue is to hardcode the left/top position by calculating the left position using this:\r\n\r\n*$.content.left = (Ti.Platform.displayCaps.platformWidth - 75) / 2;*\r\n\r\nWhere in my case 75 is the width the element has, so that'll be bigger in your case. You can do the same for height.\r\n\r\nNow, this is an iOS only solution. On Android you will need to take DPI into consideration calculating it.\r\n\r\nI do think it is a bug, though this solution works perfectly for me. I recommend looking at JIRA and see if it is a known issue, and if not, raise it with a very specific explanation of the problem, preferably with a reproducible case delivered as an app. Classic would help most. And if it is not reproducible in classic it might be an alloy issue._", "attachment": [], "flagged": false, "summary": "iOS: Change visible property sometimes change the center position of the view", "creator": { "name": "ricardo_jcp", "key": "ricardo_jcp", "displayName": "Ricardo Pereira", "active": true, "timeZone": "Europe/Lisbon" }, "subtasks": [], "reporter": { "name": "ricardo_jcp", "key": "ricardo_jcp", "displayName": "Ricardo Pereira", "active": true, "timeZone": "Europe/Lisbon" }, "environment": "I'm using the 6.0.0.GA but this always happened. I've started with Appcelerator Studio (Titanium Studio at the time)since Alloy 0.3.6", "comment": { "comments": [ { "id": "403986", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Can you please provide a full test-case for this? A single app.js file focussing on the issue helps a lot to get started in this cases. Also, can you ensure it happens on both iOS and Android?", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-01-03T13:53:35.000+0000", "updated": "2017-01-03T13:53:35.000+0000" }, { "id": "403987", "author": { "name": "topener", "key": "topener", "displayName": "Rene Pot", "active": true, "timeZone": "Europe/Berlin" }, "body": "I am not sure I've seen this happen on Android. On iOS I am certain.", "updateAuthor": { "name": "topener", "key": "topener", "displayName": "Rene Pot", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-01-03T14:12:23.000+0000", "updated": "2017-01-03T14:12:23.000+0000" }, { "id": "403989", "author": { "name": "ricardo_jcp", "key": "ricardo_jcp", "displayName": "Ricardo Pereira", "active": true, "timeZone": "Europe/Lisbon" }, "body": "I'll try to attach a simple project today (in alloy).\r\n\r\nNote that you'll need to show and hide the view many times in order to reproduce that", "updateAuthor": { "name": "ricardo_jcp", "key": "ricardo_jcp", "displayName": "Ricardo Pereira", "active": true, "timeZone": "Europe/Lisbon" }, "created": "2017-01-03T14:23:03.000+0000", "updated": "2017-01-03T14:23:03.000+0000" }, { "id": "403990", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Try a single app.js. Alloy makes it more difficult to isolate in a debugging scenario.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-01-03T14:28:22.000+0000", "updated": "2017-01-03T14:28:22.000+0000" }, { "id": "404011", "author": { "name": "ricardo_jcp", "key": "ricardo_jcp", "displayName": "Ricardo Pereira", "active": true, "timeZone": "Europe/Lisbon" }, "body": "{code:js}\r\nvar win = Ti.UI.createWindow({\r\n title: \"TIMOB-24269: Position Test\",\r\n backgroundColor: \"#fff\"\r\n});\r\n\r\nwin.add(Ti.UI.createLabel({\r\n text: \"Try Me\"\r\n}));\r\n\r\nvar popup = Ti.UI.createView({\r\n backgroundColor: \"#BF333333\",\r\n show: function() {\r\n popup.visible = true;\r\n },\r\n hide: function() {\r\n popup.visible = false;\r\n }\r\n});\r\n\r\nwin.add(popup);\r\n\r\nwin.addEventListener(\"click\", function() { \r\n if (popup.visible) {\r\n popup.hide();\r\n } else {\r\n popup.show();\r\n }\r\n});\r\n\r\nwin.open();\r\n{code}", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-01-03T18:19:21.000+0000", "updated": "2017-01-03T18:29:21.000+0000" }, { "id": "404012", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "You cannot use {{show}} and {{hide}} as properties. It's possible because of the internal proxy architecture, but it will cause bad issues. Besides that, I could not reproduce the issue with 6.0.1.GA and main-thread enabled. Other than that, you should not rely on the {{visible}} property directly after showing / hiding a view, since the view hierarchy does not synchronously update it's properties. This would cause UI-glitches and (primary) freezes.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-01-03T18:26:43.000+0000", "updated": "2017-01-03T18:30:38.000+0000" }, { "id": "404014", "author": { "name": "ricardo_jcp", "key": "ricardo_jcp", "displayName": "Ricardo Pereira", "active": true, "timeZone": "Europe/Lisbon" }, "body": "I was a basic example, in my case the show and hide methods have another name (showView, hideView, enable), but I'm using $.myView.enable(false/true);\r\n\r\nInside each view I've an JS object called 'data', all of my properties are inside that object, in my case, I'm using data.status to store the status of the view (if its opened or not)", "updateAuthor": { "name": "ricardo_jcp", "key": "ricardo_jcp", "displayName": "Ricardo Pereira", "active": true, "timeZone": "Europe/Lisbon" }, "created": "2017-01-03T18:38:26.000+0000", "updated": "2017-01-03T18:38:26.000+0000" }, { "id": "404069", "author": { "name": "topener", "key": "topener", "displayName": "Rene Pot", "active": true, "timeZone": "Europe/Berlin" }, "body": "For me it only happens when the view is initially hidden and has no left/right properties but centers automatically.", "updateAuthor": { "name": "topener", "key": "topener", "displayName": "Rene Pot", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-01-04T10:09:33.000+0000", "updated": "2017-01-04T10:09:33.000+0000" }, { "id": "404291", "author": { "name": "ricardo_jcp", "key": "ricardo_jcp", "displayName": "Ricardo Pereira", "active": true, "timeZone": "Europe/Lisbon" }, "body": "I've made a sample video: [youtube sample video|https://youtu.be/eRdi1CFk_ZE]\r\n\r\n", "updateAuthor": { "name": "ricardo_jcp", "key": "ricardo_jcp", "displayName": "Ricardo Pereira", "active": true, "timeZone": "Europe/Lisbon" }, "created": "2017-01-09T16:44:46.000+0000", "updated": "2017-01-09T16:44:46.000+0000" }, { "id": "453065", "author": { "name": "ahutton", "key": "ahutton", "displayName": "Alan Hutton", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Closing issue as “Cannot Reproduce. We have tested the code provided, and found that it is out of date with our current release (8.3.0.GA as of the date of closure), and out of date with mobile OS versions. Updating/Creating code may not reproduce the issue reported, or be a valid test case.\r\n\r\nIf community members feel that the issue is still valid, please add a comment, and include code that demonstrates/reproduces the issue.", "updateAuthor": { "name": "ahutton", "key": "ahutton", "displayName": "Alan Hutton", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-12-06T18:13:28.000+0000", "updated": "2019-12-06T18:13:28.000+0000" } ], "maxResults": 10, "total": 10, "startAt": 0 } } }