{ "id": "164823", "key": "TIMOB-24195", "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": "2", "description": "The problem described is an issue which will never be fixed.", "name": "Won't Fix" }, "resolutiondate": "2017-05-21T16:05:36.000+0000", "created": "2016-12-05T11:29:37.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [ "ios", "kroll-thread" ], "versions": [ { "id": "16980", "description": "New V8", "name": "Release 6.0.0", "archived": false, "released": true, "releaseDate": "2016-11-15" }, { "id": "18253", "name": "Release 5.5.0", "archived": false, "released": true, "releaseDate": "2016-09-13" } ], "issuelinks": [], "assignee": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "updated": "2018-08-02T22:20:09.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": "Whenever we remove a view from ScrollableView, *currentPage* and *views* properties do not change immediately. It happens in different cases but not all.\r\n\r\n*Javascript Test-Case:*\r\n{code:javascript}\r\nvar win = Ti.UI.createWindow({\r\n backgroundColor: '#fff',\r\n title: 'ScrollableView Test'\r\n});\r\n\r\nvar nav = Ti.UI.iOS.createNavigationWindow({\r\n window: win\r\n});\r\n\r\nvar scrollable = Ti.UI.createScrollableView({\r\n views: [\r\n Ti.UI.createView({top: 50, bottom: 50, left: 10, right: 10, backgroundColor: 'red'}),\r\n Ti.UI.createView({top: 50, bottom: 50, left: 10, right: 10, backgroundColor: 'teal'}),\r\n Ti.UI.createView({top: 50, bottom: 50, left: 10, right: 10, backgroundColor: 'cyan'}),\r\n Ti.UI.createView({top: 50, bottom: 50, left: 10, right: 10, backgroundColor: 'pink'}),\r\n ]\r\n});\r\n\r\nvar btn = Ti.UI.createButton({\r\n title: 'Remove view with index 1'\r\n});\r\n\r\nbtn.addEventListener('click', function() {\r\n Ti.API.info('\\nCurrent Page = ' + scrollable.currentPage);\r\n scrollable.removeView(1);\r\n Ti.API.info('Current Page = ' + scrollable.currentPage);\r\n\r\n setTimeout(function () {\r\n Ti.API.info('Current Page = ' + scrollable.currentPage); \r\n }, 500);\r\n});\r\n\r\nwin.add(scrollable);\r\nwin.setRightNavButton(btn);\r\n\r\nnav.open();\r\n{code}\r\n\r\n*Alloy Test-Case:*\r\n{code:xml}\r\n\r\n\t\r\n\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\r\n\r\n\t\t\r\n\t\r\n\r\n{code}\r\n\r\n{code:javascript}\r\nfunction remove() {\r\n Ti.API.info('\\nCurrent Page = ' + $.SCROLLABLE_VIEW.currentPage);\r\n $.SCROLLABLE_VIEW.removeView(1);\r\n Ti.API.info('Current Page = ' + $.SCROLLABLE_VIEW.currentPage);\r\n\r\n setTimeout(function () {\r\n Ti.API.info('Current Page = ' + $.SCROLLABLE_VIEW.currentPage); \r\n }, 500);\r\n}\r\n{code}\r\n\r\nTo get the bug output, click on the button after swiping to last page (index 3). This output will be shown then:\r\n\r\n{code:java}\r\n[INFO] : Current Page = 3\r\n[INFO] : Current Page = 3\r\n[INFO] : Current Page = 2\r\n{code}", "attachment": [], "flagged": false, "summary": "iOS: currentPage & views properties of Ti.UI.ScrollableView doesn't change after removing a view", "creator": { "name": "prashant_saini_1", "key": "prashant_saini_1", "displayName": "Prashant Saini", "active": true, "timeZone": "Asia/Kolkata" }, "subtasks": [], "reporter": { "name": "prashant_saini_1", "key": "prashant_saini_1", "displayName": "Prashant Saini", "active": true, "timeZone": "Asia/Kolkata" }, "environment": "Ti SDK - 5.5.1.GA\r\nAppc Studio - 4.8.0.x\r\nXcode 8\r\niOS 10\r\nMacOS 10.12.1\r\n", "closedSprints": [ { "id": 1058, "state": "closed", "name": "2018 Sprint 16 SDK", "startDate": "2018-07-29T22:26:06.486Z", "endDate": "2018-08-12T22:26:00.000Z", "completeDate": "2018-08-13T17:38:16.757Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "402550", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Hey [~prashant_saini_1], I can reproduce this issue, but only when the {{run-on-main-thread}} property is not set (or set to {{false}}) in the tiapp.xml. It's the recommended way for all apps since 5.4.0 and should be considered over using the legacy (kroll-thread) threading. You can enable it by pasting the following in the top-level tiapp.xml:\r\n{code:xml}\r\ntrue\r\n{code}\r\nWe will still look into the issue of course, but the above is the recommended way for the future.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-12-05T15:53:20.000+0000", "updated": "2016-12-05T17:22:45.000+0000" }, { "id": "402560", "author": { "name": "prashant_saini_1", "key": "prashant_saini_1", "displayName": "Prashant Saini", "active": true, "timeZone": "Asia/Kolkata" }, "body": "Thanks @hansknoechel, can you please confirm that will it work properly by setting run-on-main-thread to false as well, or do we have to set it to true only?", "updateAuthor": { "name": "prashant_saini_1", "key": "prashant_saini_1", "displayName": "Prashant Saini", "active": true, "timeZone": "Asia/Kolkata" }, "created": "2016-12-05T17:20:24.000+0000", "updated": "2016-12-05T17:20:24.000+0000" }, { "id": "402561", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Please read my comment carefully, I just updated it to be more clear. If you don't have the property or have it set to false, it won't work as (of course) the effect is the same then. \r\n\r\nThe reason for this is that the kroll-thread doesn't wait for the removal to be finished, but the main-thread does. So we'd either need to make the method asynchronous (which is no good solution) or lock the execution until all removal-operations are finished.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-12-05T17:22:29.000+0000", "updated": "2016-12-05T17:25:40.000+0000" }, { "id": "402570", "author": { "name": "prashant_saini_1", "key": "prashant_saini_1", "displayName": "Prashant Saini", "active": true, "timeZone": "Asia/Kolkata" }, "body": "Thanks again, but I do not want to use or set the property to true because there can be some weird issues in other sections of the app. I have no issue in setting this property to true, but only if it provides complete working of other codes as well. So what could be best use case of setting main thread to true apart from using Hyperloop module?", "updateAuthor": { "name": "prashant_saini_1", "key": "prashant_saini_1", "displayName": "Prashant Saini", "active": true, "timeZone": "Asia/Kolkata" }, "created": "2016-12-05T18:30:44.000+0000", "updated": "2016-12-05T18:30:44.000+0000" }, { "id": "420082", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Hey Prashant, sorry for taking so long to come back to you. I would like to answer your main-thread question more detailed:\r\n\r\nSo if have issues with run-on-main-thread, you should definitely report them. Many had the issue that child events didn't fire, which is fixed on 6.1.0 (try the RC version released last week). If it's something different, please file a JIRA for it, since it will become the default in the next major version for sure. The big advantage is that is guarantees that *UI operations* are executed on the main-thread, which is the way that Apple requires it. Previously (and this ticket is a great example for it), the kroll-thread may handle the execution, leading to weird race conditions that result in this behavior. Things like HTTP-requests or geolocation-fetches are still made on it's own thread to not block your UI, so you should already see a performance increase when activating it. And again: If not, please file a ticket to describe your issue.\r\n\r\nI hope that this will enlighten the main-thread mysts a bit. Maybe we should have called it \"run-ui-on-main-thread\" to be more specific. Thanks!", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-05-21T15:25:22.000+0000", "updated": "2017-05-21T15:25:22.000+0000" }, { "id": "439760", "author": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Closing old \"Won't fix\" tickets. If you disagree, please reopen.", "updateAuthor": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-08-02T22:20:09.000+0000", "updated": "2018-08-02T22:20:09.000+0000" } ], "maxResults": 6, "total": 6, "startAt": 0 } } }