nativescript-carousel
nativescript-carousel copied to clipboard
How to "AutoPlay" carousel items
I can't seem to find a way to get the carousel to autoPlay, is there a property for that ?
Yeah this only works on iOS, use property autoPagingInterval. It has to be higher than 0 in order to work.
Thank you @manijak, so there's no way to get this working on Android as well ?
Maybe in the future. Currently we are focused on porting the plugin to NS v3.x
@ryanzaatari I do it something like this, for Android
export function carouselLoaded(args) {
const carousel = args.object;
if (carousel.android) {
carousel.intervalAndroid = setInterval(() => {
carousel.selectedPage =
(carousel.selectedPage + 1) %
carousel.bindingContext.items.length;
}, 5000);
}
}
export function carouselUnloaded(args) {
const carousel = args.object;
if (carousel.android) {
clearInterval(carousel.intervalAndroid);
}
}