eclipsesource / tabris-js

Create native mobile apps in JavaScript or TypeScript.
https://tabrisjs.com
BSD 3-Clause "New" or "Revised" License
1.4k stars 170 forks source link

Problem with CollectionView Part 2 #2144

Open ishigo1987 opened 3 years ago

ishigo1987 commented 3 years ago

Problem description

Another problem when the CollectionView columnCount property is above 2 the performance of the CollectionView drops dramatically beyond 3 it becomes almost impossible to scroll, I have the impression that the drawing of the UI elements becomes extremely slow. (Tabris 3.1 and up, )Under these conditions it's impossible to make a multi-column emoji system like Slack for example

Expected behavior

identical collectionView performances whether you have 1 columns or n+1 columns

Environment

Code snippet

const { TextView, Composite, contentView, CollectionView} = require('tabris');

  const countriesList = [{"countryCode":"93","name":"Afghanistan","alpha2":"af","alpha3":"afg","flag":"src/icons/flag-32px/af.png"},
  {"countryCode":"27","name":"Afrique du Sud","alpha2":"za","alpha3":"zaf","flag":"src/icons/flag-32px/za.png"},
  {"countryCode":"358","name":"Îles Åland","alpha2":"ax","alpha3":"ala","flag":"src/icons/flag-32px/ax.png"},
  {"countryCode":"355","name":"Albanie","alpha2":"al","alpha3":"alb","flag":"src/icons/flag-32px/al.png"},
  {"countryCode":"213","name":"Algérie","alpha2":"dz","alpha3":"dza","flag":"src/icons/flag-32px/dz.png"},
  {"countryCode":"49","name":"Allemagne","alpha2":"de","alpha3":"deu","flag":"src/icons/flag-32px/de.png"},
  {"countryCode":"376","name":"Andorre","alpha2":"ad","alpha3":"and" ,"flag":"src/icons/flag-32px/ad.png"},
  {"countryCode":"244","name":"Angola","alpha2":"ao","alpha3":"ago" ,"flag":"src/icons/flag-32px/ao.png"},
  {"countryCode":"1-264","name":"Anguilla","alpha2":"ai","alpha3":"aia" ,"flag":"src/icons/flag-32px/ai.png"},
  {"countryCode":"672","name":"Antarctique","alpha2":"aq","alpha3":"ata" ,"flag":"src/icons/flag-32px/aq.png"},
  {"countryCode":"1-268","name":"Antigua-et-Barbuda","alpha2":"ag","alpha3":"atg","flag":"src/icons/flag-32px/ag.png"},
  {"countryCode":"966","name":"Arabie saoudite","alpha2":"sa","alpha3":"sau","flag":"src/icons/flag-32px/sa.png"},
  {"countryCode":"54","name":"Argentine","alpha2":"ar","alpha3":"arg","flag":"src/icons/flag-32px/ar.png"},
  {"countryCode":"374","name":"Arménie","alpha2":"am","alpha3":"arm","flag":"src/icons/flag-32px/am.png"},
  {"countryCode":"297","name":"Aruba","alpha2":"aw","alpha3":"abw","flag":"src/icons/flag-32px/aw.png"},
  {"countryCode":"61","name":"Australie","alpha2":"au","alpha3":"aus","flag":"src/icons/flag-32px/au.png"},
  {"countryCode":"43","name":"Autriche","alpha2":"at","alpha3":"aut","flag":"src/icons/flag-32px/at.png"},
  {"countryCode":"994","name":"Azerbaïdjan","alpha2":"az","alpha3":"aze","flag":"src/icons/flag-32px/az.png"},
  {"countryCode":"1-242","name":"Bahamas","alpha2":"bs","alpha3":"bhs","flag":"src/icons/flag-32px/bs.png"},
  {"countryCode":"973","name":"Bahreïn","alpha2":"bh","alpha3":"bhr","flag":"src/icons/flag-32px/bh.png"},
  {"countryCode":"880","name":"Bangladesh","alpha2":"bd","alpha3":"bgd","flag":"src/icons/flag-32px/bd.png"},
  {"countryCode":"1-246","name":"Barbade","alpha2":"bb","alpha3":"brb","flag":"src/icons/flag-32px/bb.png"},
  {"countryCode":"375","name":"Biélorussie","alpha2":"by","alpha3":"blr","flag":"src/icons/flag-32px/by.png"},
  {"countryCode":"32","name":"Belgique","alpha2":"be","alpha3":"bel","flag":"src/icons/flag-32px/be.png"},
  {"countryCode":"501","name":"Belize","alpha2":"bz","alpha3":"blz","flag":"src/icons/flag-32px/bz.png"},
  {"countryCode":"229","name":"Bénin","alpha2":"bj","alpha3":"ben","flag":"src/icons/flag-32px/bj.png"},
  {"countryCode":"1-441","name":"Bermudes","alpha2":"bm","alpha3":"bmu","flag":"src/icons/flag-32px/bm.png"},
  {"countryCode":"975","name":"Bhoutan","alpha2":"bt","alpha3":"btn","flag":"src/icons/flag-32px/bt.png"},
  {"countryCode":"591","name":"Bolivie","alpha2":"bo","alpha3":"bol","flag":"src/icons/flag-32px/bo.png"},
  {"countryCode":"599","name":"Pays-Bas caribéens","alpha2":"bq","alpha3":"bes","flag":"src/icons/flag-32px/bq.png"},
  {"countryCode":"387","name":"Bosnie-Herzégovine","alpha2":"ba","alpha3":"bih","flag":"src/icons/flag-32px/ba.png"},
  {"countryCode":"267","name":"Botswana","alpha2":"bw","alpha3":"bwa","flag":"src/icons/flag-32px/bw.png"},
  {"countryCode":"55","name":"Île Bouvet","alpha2":"bv","alpha3":"bvt","flag":"src/icons/flag-32px/bv.png"},
  {"countryCode":"55","name":"Brésil","alpha2":"br","alpha3":"bra","flag":"src/icons/flag-32px/br.png"},
  {"countryCode":"673","name":"Brunei","alpha2":"bn","alpha3":"brn","flag":"src/icons/flag-32px/bn.png"},
  {"countryCode":"359","name":"Bulgarie","alpha2":"bg","alpha3":"bgr","flag":"src/icons/flag-32px/bg.png"},
  {"countryCode":"226","name":"Burkina Faso","alpha2":"bf","alpha3":"bfa","flag":"src/icons/flag-32px/bf.png"},
  {"countryCode":"257","name":"Burundi","alpha2":"bi","alpha3":"bdi","flag":"src/icons/flag-32px/bi.png"},
  {"countryCode":"1-345","name":"Îles Caïmans","alpha2":"ky","alpha3":"cym","flag":"src/icons/flag-32px/ky.png"},
  {"countryCode":"855","name":"Cambodge","alpha2":"kh","alpha3":"khm","flag":"src/icons/flag-32px/kh.png"},
  {"countryCode":"237","name":"Cameroun","alpha2":"cm","alpha3":"cmr","flag":"src/icons/flag-32px/cm.png"},
  {"countryCode":"1","name":"Canada","alpha2":"ca","alpha3":"can","flag":"src/icons/flag-32px/ca.png"},
  {"countryCode":"238","name":"Cap-Vert","alpha2":"cv","alpha3":"cpv","flag":"src/icons/flag-32px/cv.png"},
  {"countryCode":"236","name":"République centrafricaine","alpha2":"cf","alpha3":"caf","flag":"src/icons/flag-32px/cf.png"},
  {"countryCode":"56","name":"Chili","alpha2":"cl","alpha3":"chl","flag":"src/icons/flag-32px/cl.png"},
  {"countryCode":"86","name":"Chine","alpha2":"cn","alpha3":"chn","flag":"src/icons/flag-32px/cn.png"},
  {"countryCode":"61","name":"Île Christmas","alpha2":"cx","alpha3":"cxr","flag":"src/icons/flag-32px/cx.png"},
  {"countryCode":"357","name":"Chypre","alpha2":"cy","alpha3":"cyp","flag":"src/icons/flag-32px/cy.png"},
  {"countryCode":"61","name":"Îles Cocos","alpha2":"cc","alpha3":"cck","flag":"src/icons/flag-32px/cc.png"},
  {"countryCode":"57","name":"Colombie","alpha2":"co","alpha3":"col","flag":"src/icons/flag-32px/co.png"},
  {"countryCode":"269","name":"Comores","alpha2":"km","alpha3":"com","flag":"src/icons/flag-32px/km.png"},
  {"countryCode":"242","name":"République du Congo","alpha2":"cg","alpha3":"cog","flag":"src/icons/flag-32px/cg.png"},
  {"countryCode":"243","name":"République démocratique du Congo","alpha2":"cd","alpha3":"cod","flag":"src/icons/flag-32px/cd.png"},
  {"countryCode":"682","name":"Îles Cook","alpha2":"ck","alpha3":"cok","flag":"src/icons/flag-32px/ck.png"},
  {"countryCode":"82","name":"Corée du Sud","alpha2":"kr","alpha3":"kor","flag":"src/icons/flag-32px/kr.png"},
  {"countryCode":"850","name":"Corée du Nord","alpha2":"kp","alpha3":"prk","flag":"src/icons/flag-32px/kp.png"},
  {"countryCode":"506","name":"Costa Rica","alpha2":"cr","alpha3":"cri","flag":"src/icons/flag-32px/cr.png"},
  {"countryCode":"225","name":"Côte d'Ivoire","alpha2":"ci","alpha3":"civ","flag":"src/icons/flag-32px/ci.png"},
  {"countryCode":"385","name":"Croatie","alpha2":"hr","alpha3":"hrv","flag":"src/icons/flag-32px/hr.png"},
  {"countryCode":"53","name":"Cuba","alpha2":"cu","alpha3":"cub","flag":"src/icons/flag-32px/cu.png"},
  {"countryCode":"599","name":"Curaçao","alpha2":"cw","alpha3":"cuw","flag":"src/icons/flag-32px/cw.png"},
  {"countryCode":"45","name":"Danemark","alpha2":"dk","alpha3":"dnk","flag":"src/icons/flag-32px/dk.png"},
  {"countryCode":"253","name":"Djibouti","alpha2":"dj","alpha3":"dji","flag":"src/icons/flag-32px/dj.png"},
  {"countryCode":"1-809","name":"République dominicaine","alpha2":"do","alpha3":"dom","flag":"src/icons/flag-32px/do.png"},
  {"countryCode":"1-767","name":"Dominique","alpha2":"dm","alpha3":"dma","flag":"src/icons/flag-32px/dm.png"},
  {"countryCode":"20","name":"Égypte","alpha2":"eg","alpha3":"egy","flag":"src/icons/flag-32px/eg.png"},
  {"countryCode":"503","name":"Salvador","alpha2":"sv","alpha3":"slv","flag":"src/icons/flag-32px/sv.png"},
  {"countryCode":"971","name":"Émirats arabes unis","alpha2":"ae","alpha3":"are","flag":"src/icons/flag-32px/ae.png"},
  {"countryCode":"593","name":"Équateur","alpha2":"ec","alpha3":"ecu","flag":"src/icons/flag-32px/ec.png"},
  {"countryCode":"291","name":"Érythrée","alpha2":"er","alpha3":"eri","flag":"src/icons/flag-32px/er.png"},
  {"countryCode":"34","name":"Espagne","alpha2":"es","alpha3":"esp","flag":"src/icons/flag-32px/es.png"},
  {"countryCode":"372","name":"Estonie","alpha2":"ee","alpha3":"est","flag":"src/icons/flag-32px/ee.png"},
  {"countryCode":"1","name":"États-Unis","alpha2":"us","alpha3":"usa","flag":"src/icons/flag-32px/us.png"},
  {"countryCode":"251","name":"Éthiopie","alpha2":"et","alpha3":"eth","flag":"src/icons/flag-32px/et.png"},
  {"countryCode":"500","name":"Malouines","alpha2":"fk","alpha3":"flk","flag":"src/icons/flag-32px/fk.png"},
  {"countryCode":"298","name":"Îles Féroé","alpha2":"fo","alpha3":"fro","flag":"src/icons/flag-32px/fo.png"},
  {"countryCode":"679","name":"Fidji","alpha2":"fj","alpha3":"fji","flag":"src/icons/flag-32px/fj.png"},
  {"countryCode":"358","name":"Finlande","alpha2":"fi","alpha3":"fin","flag":"src/icons/flag-32px/fi.png"},
  {"countryCode":"33","name":"France","alpha2":"fr","alpha3":"fra","flag":"src/icons/flag-32px/fr.png"},
  {"countryCode":"241","name":"Gabon","alpha2":"ga","alpha3":"gab","flag":"src/icons/flag-32px/ga.png"},
  {"countryCode":"220","name":"Gambie","alpha2":"gm","alpha3":"gmb","flag":"src/icons/flag-32px/gm.png"},
  {"countryCode":"995","name":"Géorgie","alpha2":"ge","alpha3":"geo","flag":"src/icons/flag-32px/ge.png"},
  {"countryCode":"500","name":"Géorgie du Sud-et-les îles Sandwich du Sud","alpha2":"gs","alpha3":"sgs","flag":"src/icons/flag-32px/gs.png"},
  {"countryCode":"233","name":"Ghana","alpha2":"gh","alpha3":"gha","flag":"src/icons/flag-32px/gh.png"},
  {"countryCode":"350","name":"Gibraltar","alpha2":"gi","alpha3":"gib","flag":"src/icons/flag-32px/gi.png"},
  {"countryCode":"30","name":"Grèce","alpha2":"gr","alpha3":"grc","flag":"src/icons/flag-32px/gr.png"},
  {"countryCode":"1-473","name":"Grenade","alpha2":"gd","alpha3":"grd","flag":"src/icons/flag-32px/gd.png"},
  {"countryCode":"299","name":"Groenland","alpha2":"gl","alpha3":"grl","flag":"src/icons/flag-32px/gl.png"},
  {"countryCode":"590","name":"Guadeloupe","alpha2":"gp","alpha3":"glp","flag":"src/icons/flag-32px/gp.png"},
  {"countryCode":"1-671","name":"Guam","alpha2":"gu","alpha3":"gum","flag":"src/icons/flag-32px/gu.png"},
  {"countryCode":"502","name":"Guatemala","alpha2":"gt","alpha3":"gtm","flag":"src/icons/flag-32px/gt.png"},
  {"countryCode":"44-1481","name":"Guernesey","alpha2":"gg","alpha3":"ggy","flag":"src/icons/flag-32px/gg.png"},
  {"countryCode":"224","name":"Guinée","alpha2":"gn","alpha3":"gin","flag":"src/icons/flag-32px/gn.png"},
  {"countryCode":"245","name":"Guinée-Bissau","alpha2":"gw","alpha3":"gnb","flag":"src/icons/flag-32px/gw.png"},
  {"countryCode":"240","name":"Guinée équatoriale","alpha2":"gq","alpha3":"gnq","flag":"src/icons/flag-32px/gq.png"},
  {"countryCode":"592","name":"Guyana","alpha2":"gy","alpha3":"guy","flag":"src/icons/flag-32px/gy.png"},
  {"countryCode":"594","name":"Guyane Francaise","alpha2":"gf","alpha3":"guf","flag":"src/icons/flag-32px/gf.png"},
  {"countryCode":"509","name":"Haïti","alpha2":"ht","alpha3":"hti","flag":"src/icons/flag-32px/ht.png"},
  {"countryCode":"0","name":"Îles Heard-et-MacDonald","alpha2":"hm","alpha3":"hmd","flag":"src/icons/flag-32px/hm.png"},
  {"countryCode":"504","name":"Honduras","alpha2":"hn","alpha3":"hnd","flag":"src/icons/flag-32px/hn.png"},
  {"countryCode":"852","name":"Hong Kong","alpha2":"hk","alpha3":"hkg","flag":"src/icons/flag-32px/hk.png"},
  {"countryCode":"36","name":"Hongrie","alpha2":"hu","alpha3":"hun","flag":"src/icons/flag-32px/hu.png"},
  {"countryCode":"44-1624","name":"Île de Man","alpha2":"im","alpha3":"imn","flag":"src/icons/flag-32px/im.png"},
  {"countryCode":"246","name":"Îles mineures éloignées des États-Unis","alpha2":"um","alpha3":"umi","flag":"src/icons/flag-32px/um.png"},
  {"countryCode":"1-284","name":"Îles Vierges britanniques","alpha2":"vg","alpha3":"vgb","flag":"src/icons/flag-32px/vg.png"},
  {"countryCode":"1-340","name":"Îles Vierges des États-Unis","alpha2":"vi","alpha3":"vir","flag":"src/icons/flag-32px/vi.png"},
  {"countryCode":"91","name":"Inde","alpha2":"in","alpha3":"ind","flag":"src/icons/flag-32px/in.png"},
  {"countryCode":"62","name":"Indonésie","alpha2":"id","alpha3":"idn","flag":"src/icons/flag-32px/id.png"},
  {"countryCode":"98","name":"Iran","alpha2":"ir","alpha3":"irn","flag":"src/icons/flag-32px/ir.png"},
  {"countryCode":"964","name":"Irak","alpha2":"iq","alpha3":"irq","flag":"src/icons/flag-32px/iq.png"},
  {"countryCode":"353","name":"Irlande","alpha2":"ie","alpha3":"irl","flag":"src/icons/flag-32px/ie.png"},
  {"countryCode":"354","name":"Islande","alpha2":"is","alpha3":"isl","flag":"src/icons/flag-32px/is.png"},
  {"countryCode":"972","name":"Israël","alpha2":"il","alpha3":"isr","flag":"src/icons/flag-32px/il.png"},
  {"countryCode":"39","name":"Italie","alpha2":"it","alpha3":"ita","flag":"src/icons/flag-32px/it.png"},
  {"countryCode":"1-876","name":"Jamaïque","alpha2":"jm","alpha3":"jam","flag":"src/icons/flag-32px/jm.png"},
  {"countryCode":"81","name":"Japon","alpha2":"jp","alpha3":"jpn","flag":"src/icons/flag-32px/jp.png"},
  {"countryCode":"44-1534","name":"Jersey","alpha2":"je","alpha3":"jey","flag":"src/icons/flag-32px/je.png"},
  {"countryCode":"962","name":"Jordanie","alpha2":"jo","alpha3":"jor","flag":"src/icons/flag-32px/jo.png"},
  {"countryCode":"7","name":"Kazakhstan","alpha2":"kz","alpha3":"kaz","flag":"src/icons/flag-32px/kz.png"},
  {"countryCode":"254","name":"Kenya","alpha2":"ke","alpha3":"ken","flag":"src/icons/flag-32px/ke.png"},
  {"countryCode":"996","name":"Kirghizistan","alpha2":"kg","alpha3":"kgz","flag":"src/icons/flag-32px/kg.png"},
  {"countryCode":"686","name":"Kiribati","alpha2":"ki","alpha3":"kir","flag":"src/icons/flag-32px/ki.png"},
  {"countryCode":"965","name":"Koweït","alpha2":"kw","alpha3":"kwt","flag":"src/icons/flag-32px/kw.png"},
  {"countryCode":"856","name":"Laos","alpha2":"la","alpha3":"lao","flag":"src/icons/flag-32px/la.png"},
  {"countryCode":"266","name":"Lesotho","alpha2":"ls","alpha3":"lso","flag":"src/icons/flag-32px/ls.png"},
  {"countryCode":"371","name":"Lettonie","alpha2":"lv","alpha3":"lva","flag":"src/icons/flag-32px/lv.png"},
  {"countryCode":"961","name":"Liban","alpha2":"lb","alpha3":"lbn","flag":"src/icons/flag-32px/lb.png"},
  {"countryCode":"231","name":"Liberia","alpha2":"lr","alpha3":"lbr","flag":"src/icons/flag-32px/lr.png"},
  {"countryCode":"218","name":"Libye","alpha2":"ly","alpha3":"lby","flag":"src/icons/flag-32px/ly.png"},
  {"countryCode":"423","name":"Liechtenstein","alpha2":"li","alpha3":"lie","flag":"src/icons/flag-32px/li.png"},
  {"countryCode":"370","name":"Lituanie","alpha2":"lt","alpha3":"ltu","flag":"src/icons/flag-32px/lt.png"},
  {"countryCode":"352","name":"Luxembourg","alpha2":"lu","alpha3":"lux","flag":"src/icons/flag-32px/lu.png"},
  {"countryCode":"853","name":"Macao","alpha2":"mo","alpha3":"mac","flag":"src/icons/flag-32px/mo.png"},
  {"countryCode":"389","name":"Macédoine du Nord","alpha2":"mk","alpha3":"mkd","flag":"src/icons/flag-32px/mk.png"},
  {"countryCode":"261","name":"Madagascar","alpha2":"mg","alpha3":"mdg","flag":"src/icons/flag-32px/mg.png"},
  {"countryCode":"60","name":"Malaisie","alpha2":"my","alpha3":"mys","flag":"src/icons/flag-32px/my.png"},
  {"countryCode":"265","name":"Malawi","alpha2":"mw","alpha3":"mwi","flag":"src/icons/flag-32px/mw.png"},
  {"countryCode":"960","name":"Maldives","alpha2":"mv","alpha3":"mdv","flag":"src/icons/flag-32px/mv.png"},
  {"countryCode":"223","name":"Mali","alpha2":"ml","alpha3":"mli","flag":"src/icons/flag-32px/ml.png"},
  {"countryCode":"356","name":"Malte","alpha2":"mt","alpha3":"mlt","flag":"src/icons/flag-32px/mt.png"},
  {"countryCode":"1-670","name":"Îles Mariannes du Nord","alpha2":"mp","alpha3":"mnp","flag":"src/icons/flag-32px/mp.png"},
  {"countryCode":"212","name":"Maroc","alpha2":"ma","alpha3":"mar","flag":"src/icons/flag-32px/ma.png"},
  {"countryCode":"692","name":"Îles Marshall","alpha2":"mh","alpha3":"mhl","flag":"src/icons/flag-32px/mh.png"},
  {"countryCode":"596","name":"Martinique","alpha2":"mq","alpha3":"mtq","flag":"src/icons/flag-32px/mq.png"},
  {"countryCode":"230","name":"Maurice","alpha2":"mu","alpha3":"mus","flag":"src/icons/flag-32px/mu.png"},
  {"countryCode":"222","name":"Mauritanie","alpha2":"mr","alpha3":"mrt","flag":"src/icons/flag-32px/mr.png"},
  {"countryCode":"262","name":"Mayotte","alpha2":"yt","alpha3":"myt","flag":"src/icons/flag-32px/yt.png"},
  {"countryCode":"52","name":"Mexique","alpha2":"mx","alpha3":"mex","flag":"src/icons/flag-32px/mx.png"},
  {"countryCode":"691","name":"États fédérés de Micronésie","alpha2":"fm","alpha3":"fsm","flag":"src/icons/flag-32px/fm.png"},
  {"countryCode":"373","name":"Moldavie","alpha2":"md","alpha3":"mda","flag":"src/icons/flag-32px/md.png"},
  {"countryCode":"377","name":"Monaco","alpha2":"mc","alpha3":"mco","flag":"src/icons/flag-32px/mc.png"},
  {"countryCode":"976","name":"Mongolie","alpha2":"mn","alpha3":"mng","flag":"src/icons/flag-32px/mn.png"},
  {"countryCode":"382","name":"Monténégro","alpha2":"me","alpha3":"mne","flag":"src/icons/flag-32px/me.png"},
  {"countryCode":"1-664","name":"Montserrat","alpha2":"ms","alpha3":"msr","flag":"src/icons/flag-32px/ms.png"},
  {"countryCode":"258","name":"Mozambique","alpha2":"mz","alpha3":"moz","flag":"src/icons/flag-32px/mz.png"},
  {"countryCode":"95","name":"Birmanie","alpha2":"mm","alpha3":"mmr","flag":"src/icons/flag-32px/mm.png"},
  {"countryCode":"264","name":"Namibie","alpha2":"na","alpha3":"nam","flag":"src/icons/flag-32px/na.png"},
  {"countryCode":"674","name":"Nauru","alpha2":"nr","alpha3":"nru","flag":"src/icons/flag-32px/nr.png"},
  {"countryCode":"977","name":"Népal","alpha2":"np","alpha3":"npl","flag":"src/icons/flag-32px/np.png"},
  {"countryCode":"505","name":"Nicaragua","alpha2":"ni","alpha3":"nic","flag":"src/icons/flag-32px/ni.png"},
  {"countryCode":"227","name":"Niger","alpha2":"ne","alpha3":"ner","flag":"src/icons/flag-32px/ne.png"},
  {"countryCode":"234","name":"Nigeria","alpha2":"ng","alpha3":"nga","flag":"src/icons/flag-32px/ng.png"},
  {"countryCode":"683","name":"Niue","alpha2":"nu","alpha3":"niu","flag":"src/icons/flag-32px/nu.png"},
  {"countryCode":"672","name":"Île Norfolk","alpha2":"nf","alpha3":"nfk","flag":"src/icons/flag-32px/nf.png"},
  {"countryCode":"47","name":"Norvège","alpha2":"no","alpha3":"nor","flag":"src/icons/flag-32px/no.png"},
  {"countryCode":"687","name":"Nouvelle-Calédonie","alpha2":"nc","alpha3":"ncl","flag":"src/icons/flag-32px/nc.png"},
  {"countryCode":"64","name":"Nouvelle-Zélande","alpha2":"nz","alpha3":"nzl","flag":"src/icons/flag-32px/nz.png"},
  {"countryCode":"246","name":"Territoire britannique de l'océan Indien","alpha2":"io","alpha3":"iot","flag":"src/icons/flag-32px/io.png"},
  {"countryCode":"968","name":"Oman","alpha2":"om","alpha3":"omn","flag":"src/icons/flag-32px/om.png"},
  {"countryCode":"256","name":"Ouganda","alpha2":"ug","alpha3":"uga","flag":"src/icons/flag-32px/ug.png"},
  {"countryCode":"998","name":"Ouzbékistan","alpha2":"uz","alpha3":"uzb","flag":"src/icons/flag-32px/uz.png"},
  {"countryCode":"92","name":"Pakistan","alpha2":"pk","alpha3":"pak","flag":"src/icons/flag-32px/pk.png"},
  {"countryCode":"680","name":"Palaos","alpha2":"pw","alpha3":"plw","flag":"src/icons/flag-32px/pw.png"},
  {"countryCode":"970","name":"Palestine","alpha2":"ps","alpha3":"pse","flag":"src/icons/flag-32px/ps.png"},
  {"countryCode":"507","name":"Panama","alpha2":"pa","alpha3":"pan","flag":"src/icons/flag-32px/pa.png"},
  {"countryCode":"675","name":"Papouasie-Nouvelle-Guinée","alpha2":"pg","alpha3":"png","flag":"src/icons/flag-32px/pg.png"},
  {"countryCode":"595","name":"Paraguay","alpha2":"py","alpha3":"pry","flag":"src/icons/flag-32px/py.png"},
  {"countryCode":"31","name":"Pays-Bas","alpha2":"nl","alpha3":"nld","flag":"src/icons/flag-32px/nl.png"},
  {"countryCode":"51","name":"Pérou","alpha2":"pe","alpha3":"per","flag":"src/icons/flag-32px/pe.png"},
  {"countryCode":"63","name":"Philippines","alpha2":"ph","alpha3":"phl","flag":"src/icons/flag-32px/ph.png"},
  {"countryCode":"64","name":"Îles Pitcairn","alpha2":"pn","alpha3":"pcn","flag":"src/icons/flag-32px/pn.png"},
  {"countryCode":"48","name":"Pologne","alpha2":"pl","alpha3":"pol","flag":"src/icons/flag-32px/pl.png"},
  {"countryCode":"689","name":"Polynésie française","alpha2":"pf","alpha3":"pyf","flag":"src/icons/flag-32px/pf.png"},
  {"countryCode":"1-787","name":"Porto Rico","alpha2":"pr","alpha3":"pri","flag":"src/icons/flag-32px/pr.png"},
  {"countryCode":"351","name":"Portugal","alpha2":"pt","alpha3":"prt","flag":"src/icons/flag-32px/pt.png"},
  {"countryCode":"974","name":"Qatar","alpha2":"qa","alpha3":"qat","flag":"src/icons/flag-32px/qa.png"},
  {"countryCode":"262","name":"La Réunion","alpha2":"re","alpha3":"reu","flag":"src/icons/flag-32px/re.png"},
  {"countryCode":"40","name":"Roumanie","alpha2":"ro","alpha3":"rou","flag":"src/icons/flag-32px/ro.png"},
  {"countryCode":"44","name":"Royaume-Uni","alpha2":"gb","alpha3":"gbr","flag":"src/icons/flag-32px/gb.png"},
  {"countryCode":"7","name":"Russie","alpha2":"ru","alpha3":"rus","flag":"src/icons/flag-32px/ru.png"},
  {"countryCode":"250","name":"Rwanda","alpha2":"rw","alpha3":"rwa","flag":"src/icons/flag-32px/rw.png"},
  {"countryCode":"212","name":"République arabe sahraouie démocratique","alpha2":"eh","alpha3":"esh","flag":"src/icons/flag-32px/eh.png"},
  {"countryCode":"590","name":"Saint-Barthélemy","alpha2":"bl","alpha3":"blm","flag":"src/icons/flag-32px/bl.png"},
  {"countryCode":"1-869","name":"Saint-Christophe-et-Niévès","alpha2":"kn","alpha3":"kna","flag":"src/icons/flag-32px/kn.png"},
  {"countryCode":"39","name":"Saint-Marin","alpha2":"sm","alpha3":"smr","flag":"src/icons/flag-32px/sm.png"},
  {"countryCode":"590","name":"Saint-Martin partie Française","alpha2":"mf","alpha3":"maf","flag":"src/icons/flag-32px/mf.png"},
  {"countryCode":"590","name":"Saint-Martin partie Allemande","alpha2":"sx","alpha3":"sxm","flag":"src/icons/flag-32px/sx.png"},
  {"countryCode":"508","name":"Saint-Pierre-et-Miquelon","alpha2":"pm","alpha3":"spm","flag":"src/icons/flag-32px/pm.png"},
  {"countryCode":"379","name":"Saint-Siège (État de la Cité du Vatican)","alpha2":"va","alpha3":"vat","flag":"src/icons/flag-32px/va.png"},
  {"countryCode":"1-784","name":"Saint-Vincent-et-les-Grenadines","alpha2":"vc","alpha3":"vct","flag":"src/icons/flag-32px/vc.png"},
  {"countryCode":"290","name":"Sainte-Hélène, Ascension et Tristan da Cunha","alpha2":"sh","alpha3":"shn","flag":"src/icons/flag-32px/sh.png"},
  {"countryCode":"1-758","name":"Sainte-Lucie","alpha2":"lc","alpha3":"lca","flag":"src/icons/flag-32px/lc.png"},
  {"countryCode":"677","name":"Salomon","alpha2":"sb","alpha3":"slb","flag":"src/icons/flag-32px/sb.png"},
  {"countryCode":"685","name":"Samoa","alpha2":"ws","alpha3":"wsm","flag":"src/icons/flag-32px/ws.png"},
  {"countryCode":"1-684","name":"Samoa américaines","alpha2":"as","alpha3":"asm","flag":"src/icons/flag-32px/as.png"},
  {"countryCode":"239","name":"Sao Tomé-et-Principe","alpha2":"st","alpha3":"stp","flag":"src/icons/flag-32px/st.png"},
  {"countryCode":"221","name":"Sénégal","alpha2":"sn","alpha3":"sen","flag":"src/icons/flag-32px/sn.png"},
  {"countryCode":"381","name":"Serbie","alpha2":"rs","alpha3":"srb","flag":"src/icons/flag-32px/rs.png"},
  {"countryCode":"248","name":"Seychelles","alpha2":"sc","alpha3":"syc","flag":"src/icons/flag-32px/sc.png"},
  {"countryCode":"232","name":"Sierra Leone","alpha2":"sl","alpha3":"sle","flag":"src/icons/flag-32px/sl.png"},
  {"countryCode":"65","name":"Singapour","alpha2":"sg","alpha3":"sgp","flag":"src/icons/flag-32px/sg.png"},
  {"countryCode":"421","name":"Slovaquie","alpha2":"sk","alpha3":"svk","flag":"src/icons/flag-32px/sk.png"},
  {"countryCode":"386","name":"Slovénie","alpha2":"si","alpha3":"svn","flag":"src/icons/flag-32px/si.png"},
  {"countryCode":"252","name":"Somalie","alpha2":"so","alpha3":"som","flag":"src/icons/flag-32px/so.png"},
  {"countryCode":"249","name":"Soudan","alpha2":"sd","alpha3":"sdn","flag":"src/icons/flag-32px/sd.png"},
  {"countryCode":"211","name":"Soudan du Sud","alpha2":"ss","alpha3":"ssd","flag":"src/icons/flag-32px/ss.png"},
  {"countryCode":"94","name":"Sri Lanka","alpha2":"lk","alpha3":"lka","flag":"src/icons/flag-32px/lk.png"},
  {"countryCode":"46","name":"Suède","alpha2":"se","alpha3":"swe","flag":"src/icons/flag-32px/se.png"},
  {"countryCode":"41","name":"Suisse","alpha2":"ch","alpha3":"che","flag":"src/icons/flag-32px/ch.png"},
  {"countryCode":"597","name":"Suriname","alpha2":"sr","alpha3":"sur","flag":"src/icons/flag-32px/sr.png"},
  {"countryCode":"47","name":"Svalbard et ile Jan Mayen","alpha2":"sj","alpha3":"sjm","flag":"src/icons/flag-32px/sj.png"},
  {"countryCode":"268","name":"Swaziland","alpha2":"sz","alpha3":"swz","flag":"src/icons/flag-32px/sz.png"},
  {"countryCode":"963","name":"Syrie","alpha2":"sy","alpha3":"syr","flag":"src/icons/flag-32px/sy.png"},
  {"countryCode":"992","name":"Tadjikistan","alpha2":"tj","alpha3":"tjk","flag":"src/icons/flag-32px/tj.png"},
  {"countryCode":"886","name":"Taïwan \/ (République de Chine (Taïwan))","alpha2":"tw","alpha3":"twn","flag":"src/icons/flag-32px/tw.png"},
  {"countryCode":"255","name":"Tanzanie","alpha2":"tz","alpha3":"tza","flag":"src/icons/flag-32px/tz.png"},
  {"countryCode":"235","name":"Tchad","alpha2":"td","alpha3":"tcd","flag":"src/icons/flag-32px/td.png"},
  {"countryCode":"420","name":"Tchéquie","alpha2":"cz","alpha3":"cze","flag":"src/icons/flag-32px/cz.png"},
  {"countryCode":"262","name":"Terres australes et antarctiques françaises","alpha2":"tf","alpha3":"atf","flag":"src/icons/flag-32px/tf.png"},
  {"countryCode":"66","name":"Thaïlande","alpha2":"th","alpha3":"tha","flag":"src/icons/flag-32px/th.png"},
  {"countryCode":"670","name":"Timor oriental","alpha2":"tl","alpha3":"tls","flag":"src/icons/flag-32px/tl.png"},
  {"countryCode":"228","name":"Togo","alpha2":"tg","alpha3":"tgo","flag":"src/icons/flag-32px/tg.png"},
  {"countryCode":"690","name":"Tokelau","alpha2":"tk","alpha3":"tkl","flag":"src/icons/flag-32px/tk.png"},
  {"countryCode":"676","name":"Tonga","alpha2":"to","alpha3":"ton","flag":"src/icons/flag-32px/to.png"},
  {"countryCode":"1-868","name":"Trinité-et-Tobago","alpha2":"tt","alpha3":"tto","flag":"src/icons/flag-32px/tt.png"},
  {"countryCode":"216","name":"Tunisie","alpha2":"tn","alpha3":"tun","flag":"src/icons/flag-32px/tn.png"},
  {"countryCode":"993","name":"Turkménistan","alpha2":"tm","alpha3":"tkm","flag":"src/icons/flag-32px/tm.png"},
  {"countryCode":"1-649","name":"Îles Turques-et-Caïques","alpha2":"tc","alpha3":"tca","flag":"src/icons/flag-32px/tc.png"},
  {"countryCode":"90","name":"Turquie","alpha2":"tr","alpha3":"tur","flag":"src/icons/flag-32px/tr.png"},
  {"countryCode":"688","name":"Tuvalu","alpha2":"tv","alpha3":"tuv","flag":"src/icons/flag-32px/tv.png"},
  {"countryCode":"380","name":"Ukraine","alpha2":"ua","alpha3":"ukr","flag":"src/icons/flag-32px/ua.png"},
  {"countryCode":"598","name":"Uruguay","alpha2":"uy","alpha3":"ury","flag":"src/icons/flag-32px/uy.png"},
  {"countryCode":"678","name":"Vanuatu","alpha2":"vu","alpha3":"vut","flag":"src/icons/flag-32px/vu.png"},
  {"countryCode":"58","name":"Venezuela","alpha2":"ve","alpha3":"ven","flag":"src/icons/flag-32px/ve.png"},
  {"countryCode":"84","name":"Viêt Nam","alpha2":"vn","alpha3":"vnm","flag":"src/icons/flag-32px/vn.png"},
  {"countryCode":"681","name":"Wallis-et-Futuna","alpha2":"wf","alpha3":"wlf","flag":"src/icons/flag-32px/wf.png"},
  {"countryCode":"967","name":"Yémen","alpha2":"ye","alpha3":"yem","flag":"src/icons/flag-32px/ye.png"},
  {"countryCode":"260","name":"Zambie","alpha2":"zm","alpha3":"zmb","flag":"src/icons/flag-32px/zm.png"},
  {"countryCode":"263","name":"Zimbabwe","alpha2":"zw","alpha3":"zwe","flag":"src/icons/flag-32px/zw.png"}]

  new CollectionView({

    top: 0, left: 0, right: 0, bottom: 0, scrollbarVisible:false, itemCount: countriesList.length, columnCount:4, cellHeight: 55,

    createCell: () => {

      const cell = new Composite({ left: 0, right: 0, height: 64});

      new TextView({ centerY: 0, right: 15, textColor: "#757575", id: "countryCode" }).appendTo(cell);

      return cell;

    }, 

    updateCell: (cell, index) => {

      cell.find("#countryCode").only().text = "+"+countriesList[index].countryCode;
    }

  }).appendTo(contentView);
cookieguru commented 3 years ago

Have you tried using a ScrollView?

ishigo1987 commented 3 years ago

yes with the scrollview it will take a long time to add all these elements, and using the scrollView is counter-intuitive since the collectionView is precisely used to set the quick display of this kind of list

elshadsm commented 3 years ago

@ishigo1987, I have tested the snippet that you provided with Samsung A70 (Android 10) and Emulator Pixel 2 XL (Android 8.1) and it works as expected for me, or at least I couldn't reproduce any performance issue.

I see that you have flag property in your example list that contains a path to PNG files. I suggest using relevant emoji unicodes instead. For example, if you want to use the German flag, you should click the Germany link and use the code JavaScript (JSON) & Java: \ud83c\udde9\ud83c\uddea. Something like this:

updateCell: (cell, index) => {
    cell.find("#countryCode").only().text = '\ud83c\udde9\ud83c\uddea';
  }

You can use other emojis from other sources as well.

ishigo1987 commented 3 years ago

ok thanks a lot for the advice but in our case the flags in the Json file are not used at all for the collectionView, if you saw in the updateCell I only use the countryCode key.

If you can try to do the test in a real phone and not on the emulator I think you'll see the performance problem. I'll make a video tomorrow to show you the behavior on my phone.

ishigo1987 commented 3 years ago

https://user-images.githubusercontent.com/12398336/108838456-f42bea00-75d3-11eb-8a78-01a3a2c94db5.mp4 @elshadsm in this video, you can see the slowness when i scroll the CollectionView.i use the same snippet from the biginning