Is it possible to have multiple repeaters on same screen?


#1

Since the repeater can have only one template, is it possible to have multiple repeaters on the same screen?


#2

Yes, you can have multiple repeaters. Depending on what you are doing this might not be a good idea… ListView’s are much better if you have a lot of data…

Nathanael A.


#3

Thanks for the tip, I’ll keep that in mind.


#4

If you have custom UI to represent your repeaters that do not belong in a list layout, you can go crazy with repeaters. Just be certain to do the following:

  • Limit the display results in sections (i.e. display the first 10 results of a collection)
  • Pop results in/out the viewport (as you scroll update where in the collection the results are displaying)

If you follow this methodology scaling and performance should not be a problem. I’ve done this personally in both angular (web) components and in :nativescript: and had no problems with thousands/infinite of results.

In Android they have RecylerView and in iOS they use UICollectionView.


#5

Thanks Sean for the interesting insight! I’m brand new to :nativescript: so I have a lot more questions to your answer.

• “custom UI to represent my repeaters” - Does that mean not use Repeater.itemsLayout & Repeater.itemTemplate ?
• “display results in sections” - what would that look like with scrolling? (sorry, only sections I know is in HTML)
• How would I “Pop results in/out the viewport as you scroll” ?

Do you know where I might get more info (examples) on your techniques you’re talking about?

Thanks so much for your thoughts.