Is there a way to programmatically perform a swipe action on a radlistview item?

379 views Asked by At

I am using nativescript & angular and I have a RadListView with tap-to-execute swipe actions. Left swipe shows a delete button , right swipe shows an "options" button.

After the items are loaded I want to programmatically swipe to the right the first item. I know I can get the view of the first item with getViewItemAt(O) but I don't know if it's possible or how to apply a programatic swipe gesture to it

1

There are 1 answers

1
NevaGiveUp On

UPDATE

If anyone else is looking for this it can be achieved by simply animating the item view

... items loaded ... then 
{
    let item = this.radList.listView.getItemAtIndex(0);
    let view = this.radList.listView.getViewForItem(item);
    setTimeout(()=> {
        //animate on x axis - will show the swipe action at the right 
        view.animate({
            translate: { x: 80, y: 0},
            duration: 50,
            curve: AnimationCurve.spring
        });
        //animate back to hide it
        setTimeout(()=> {
            view.animate({
                translate: { x: 0, y: 0},
                duration: 50,
                curve: AnimationCurve.spring
            });
        }, 1000);

    }, 2000);  
}
...