Skip to content

Commit 81fbbb8

Browse files
committed
fix(list): add closeSlidingItems()
fixes #15378
1 parent cf35445 commit 81fbbb8

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

core/src/components/list/list.tsx

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component, Prop } from '@stencil/core';
1+
import { Component, Element, Method, Prop } from '@stencil/core';
22

33
import { Mode } from '../../interface';
44
import { createThemedClasses } from '../../utils/theme';
@@ -11,7 +11,14 @@ import { createThemedClasses } from '../../utils/theme';
1111
}
1212
})
1313
export class List {
14-
mode!: Mode;
14+
15+
@Element() el!: HTMLElement;
16+
17+
/**
18+
* The mode determines which platform styles to use.
19+
* Possible values are: `"ios"` or `"md"`.
20+
*/
21+
@Prop() mode!: Mode;
1522

1623
/**
1724
* How the bottom border should be displayed on all items.
@@ -24,6 +31,15 @@ export class List {
2431
*/
2532
@Prop() inset = false;
2633

34+
@Method()
35+
async closeSlidingItems(): Promise<boolean> {
36+
const item = this.el.querySelector('ion-item-sliding');
37+
if (item && item.closeOpened) {
38+
return item.closeOpened();
39+
}
40+
return false;
41+
}
42+
2743
hostData() {
2844
return {
2945
class: {

0 commit comments

Comments
 (0)