The close
method seems to work, but the open method does not. Here is an example of using the close method:
const handleSlide = async (event: any) => {
const ratio = await event.target.getSlidingRatio();
if (ratio >= 3) {
await event.target.close();
}
};
return (
<IonItemSliding css={style} onIonDrag={handleSlide}>
<IonItem>Testing...</IonItem>
<IonItemOptions side="end">
<IonItemOption color="danger" expandable>
<Icon icon="icons8:trash" className="icon" />
</IonItemOption>
</IonItemOptions>
</IonItemSliding>
);
Here is the behavior:
Works as expected.
But when I change to the open
method, it does not work.
const handleSlide = async (event: any) => {
const ratio = await event.target.getSlidingRatio();
if (ratio >= 3) {
await event.target.open();
}
};
return (
<IonItemSliding css={style} onIonDrag={handleSlide}>
<IonItem>Testing...</IonItem>
<IonItemOptions side="end">
<IonItemOption color="danger" expandable>
<Icon icon="icons8:trash" className="icon" />
</IonItemOption>
</IonItemOptions>
</IonItemSliding>
);
Here is the behavior:
As you can see, when I drag past the 30% mark, nothing happens.
I would expect it slide open.
PS: I’ve also tried with open('end')
and open('start')
but nothing.