nativescript-carousel icon indicating copy to clipboard operation
nativescript-carousel copied to clipboard

How to "AutoPlay" carousel items

Open ryanzaatari opened this issue 8 years ago • 4 comments

I can't seem to find a way to get the carousel to autoPlay, is there a property for that ?

ryanzaatari avatar May 15 '17 12:05 ryanzaatari

Yeah this only works on iOS, use property autoPagingInterval. It has to be higher than 0 in order to work.

manijak avatar May 15 '17 19:05 manijak

Thank you @manijak, so there's no way to get this working on Android as well ?

ryanzaatari avatar May 16 '17 09:05 ryanzaatari

Maybe in the future. Currently we are focused on porting the plugin to NS v3.x

manijak avatar May 16 '17 09:05 manijak

@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);
    }
}

shiv19 avatar May 20 '19 01:05 shiv19