{"action":"created","issue":{"url":"https://api.github.com/repos/NativeScript/NativeScript/issues/3180","repository_url":"https://api.github.com/repos/NativeScript/NativeScript","labels_url":"https://api.github.com/repos/NativeScript/NativeScript/issues/3180/labels{/name}","comments_url":"https://api.github.com/repos/NativeScript/NativeScript/issues/3180/comments","events_url":"https://api.github.com/repos/NativeScript/NativeScript/issues/3180/events","html_url":"https://github.com/NativeScript/NativeScript/issues/3180","id":191816503,"number":3180,"title":"Android ListView performance when row class is assigned","user":{"login":"snekbaev","id":6025502,"avatar_url":"https://avatars.githubusercontent.com/u/6025502?v=3","gravatar_id":"","url":"https://api.github.com/users/snekbaev","html_url":"https://github.com/snekbaev","followers_url":"https://api.github.com/users/snekbaev/followers","following_url":"https://api.github.com/users/snekbaev/following{/other_user}","gists_url":"https://api.github.com/users/snekbaev/gists{/gist_id}","starred_url":"https://api.github.com/users/snekbaev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/snekbaev/subscriptions","organizations_url":"https://api.github.com/users/snekbaev/orgs","repos_url":"https://api.github.com/users/snekbaev/repos","events_url":"https://api.github.com/users/snekbaev/events{/privacy}","received_events_url":"https://api.github.com/users/snekbaev/received_events","type":"User","site_admin":false},"labels":[{"id":203690377,"url":"https://api.github.com/repos/NativeScript/NativeScript/labels/Android","name":"Android","color":"c7def8","default":false},{"id":203689647,"url":"https://api.github.com/repos/NativeScript/NativeScript/labels/T:Question","name":"T:Question","color":"fbca04","default":false}],"state":"open","locked":false,"assignee":{"login":"tsonevn","id":17448734,"avatar_url":"https://avatars.githubusercontent.com/u/17448734?v=3","gravatar_id":"","url":"https://api.github.com/users/tsonevn","html_url":"https://github.com/tsonevn","followers_url":"https://api.github.com/users/tsonevn/followers","following_url":"https://api.github.com/users/tsonevn/following{/other_user}","gists_url":"https://api.github.com/users/tsonevn/gists{/gist_id}","starred_url":"https://api.github.com/users/tsonevn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tsonevn/subscriptions","organizations_url":"https://api.github.com/users/tsonevn/orgs","repos_url":"https://api.github.com/users/tsonevn/repos","events_url":"https://api.github.com/users/tsonevn/events{/privacy}","received_events_url":"https://api.github.com/users/tsonevn/received_events","type":"User","site_admin":false},"assignees":[{"login":"tsonevn","id":17448734,"avatar_url":"https://avatars.githubusercontent.com/u/17448734?v=3","gravatar_id":"","url":"https://api.github.com/users/tsonevn","html_url":"https://github.com/tsonevn","followers_url":"https://api.github.com/users/tsonevn/followers","following_url":"https://api.github.com/users/tsonevn/following{/other_user}","gists_url":"https://api.github.com/users/tsonevn/gists{/gist_id}","starred_url":"https://api.github.com/users/tsonevn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tsonevn/subscriptions","organizations_url":"https://api.github.com/users/tsonevn/orgs","repos_url":"https://api.github.com/users/tsonevn/repos","events_url":"https://api.github.com/users/tsonevn/events{/privacy}","received_events_url":"https://api.github.com/users/tsonevn/received_events","type":"User","site_admin":false}],"milestone":null,"comments":4,"created_at":"2016-11-26T17:19:38Z","updated_at":"2016-11-28T14:06:18Z","closed_at":null,"body":"Hi,\r\n\r\nAndroid, Nexus 5 with Marshmallow, NS 2.4.0. TS + NG. Plugins:\r\n```\r\n\"nativescript-angular\": \"1.1.3\",\r\n\"nativescript-direct-sms-send\": \"file:..\\\\nativescript_modules\\\\direct-sms-send\",\r\n\"nativescript-messenger\": \"^1.2.0\",\r\n\"nativescript-permissions\": \"^1.2.1\",\r\n\"nativescript-ripple\": \"^1.0.1\", \r\n```\r\n\r\nI'm rendering a listview, content is quite simple, images used are either A.png or B.png from the resources, each image size is around 2.7KB. Items count is around 50 elements for now. I wanted to set different background for even rows and followed the official guide:\r\n\r\n```\r\n<ListView [items]=\"listItems\" rowHeight=\"60\" visibility=\"{{ !isLoading ? 'visible' : 'collapsed' }}\">\r\n    <template let-item=\"item\" let-i=\"index\" let-odd=\"odd\" let-even=\"even\">\r\n        <StackLayout [class.odd]=\"odd\" [class.even]=\"even\">\r\n            <Image [src]=\"item.image\"></Image>\r\n            <Label [text]='item.date' textWrap=\"true\"></Label>\r\n        </StackLayout>\r\n    </template>\r\n</ListView>\r\n```\r\nstyles:\r\n```\r\n.odd {\r\n}\r\n\r\n.even {\r\n    background-color: #FDFDFD;\r\n}\r\n```\r\nhowever when I scroll the list fast I notice lags or even hiccups, doesn't feel very smooth. When I navigate away from the view and come back, performance is a bit better, but aforementioned issues remain. I tried to improve it by assigning the class directly:\r\n\r\n```\r\n<ListView [items]=\"listItems\" rowHeight=\"60\" visibility=\"{{ !isLoading ? 'visible' : 'collapsed' }}\">\r\n    <template let-item=\"item\">\r\n        <StackLayout [class]=\"item.listClass\">    \r\n            <Image [src]=\"item.image\"></Image>\r\n            <Label [text]='item.date' textWrap=\"true\"></Label>\r\n        </StackLayout>\r\n    </template>\r\n</ListView>\r\n```\r\n\r\nfeels a bit better, but still... The only way I managed to get the best and smoothest experience was to give up any class assignments and just do:\r\n\r\n```\r\n<ListView [items]=\"listItems\" rowHeight=\"60\" visibility=\"{{ !isLoading ? 'visible' : 'collapsed' }}\">\r\n    <template let-item=\"item\">\r\n        <StackLayout> \r\n            <Image [src]=\"item.image\"></Image>\r\n            <Label [text]='item.date' textWrap=\"true\"></Label>\r\n        </StackLayout>\r\n    </template>\r\n</ListView>\r\n```\r\n\r\nThank you!\r\n\r\nP.S.: tried to assign the row height (rowHeight) via CSS, but seems that it is not supported yet, so inlined"},"comment":{"url":"https://api.github.com/repos/NativeScript/NativeScript/issues/comments/263279171","html_url":"https://github.com/NativeScript/NativeScript/issues/3180#issuecomment-263279171","issue_url":"https://api.github.com/repos/NativeScript/NativeScript/issues/3180","id":263279171,"user":{"login":"snekbaev","id":6025502,"avatar_url":"https://avatars.githubusercontent.com/u/6025502?v=3","gravatar_id":"","url":"https://api.github.com/users/snekbaev","html_url":"https://github.com/snekbaev","followers_url":"https://api.github.com/users/snekbaev/followers","following_url":"https://api.github.com/users/snekbaev/following{/other_user}","gists_url":"https://api.github.com/users/snekbaev/gists{/gist_id}","starred_url":"https://api.github.com/users/snekbaev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/snekbaev/subscriptions","organizations_url":"https://api.github.com/users/snekbaev/orgs","repos_url":"https://api.github.com/users/snekbaev/repos","events_url":"https://api.github.com/users/snekbaev/events{/privacy}","received_events_url":"https://api.github.com/users/snekbaev/received_events","type":"User","site_admin":false},"created_at":"2016-11-28T14:06:18Z","updated_at":"2016-11-28T14:06:18Z","body":"Hi,\r\n\r\nthere you go: https://drive.google.com/open?id=0B_AKy2bw0LtuVjlpWTA5U3hzSEE\r\n\r\nSo basically you need ```app.component.html```.\r\n\r\nFor the ultimate experience you need:\r\n```\r\n<template let-item=\"item\">\r\n```\r\nfor way less awesomeness you want:\r\n```\r\n<template let-item=\"item\" let-odd=\"odd\" let-even=\"even\">\r\n```\r\n\r\nTry comparing both: scroll fast, scroll again and again while list is already scrolling, do the instant opposite scrolling while list is still scrolling etc. Watch the side scroll position indicator, how it moves. Without classes it is just outstanding and very responsive, however, when classes are used scroll indicator visibly moves less smooth, sometimes jumps a bit, occasionally scrolling freezes and in a couple of seconds ListView tries to catch-up with the gestures it has missed.\r\n\r\nThank you!\r\n"}}
{"actor":{"display_login":"snekbaev"}}