Skip to content

Commit ab4addb

Browse files
committed
fix(swipemenu): swipeMenuId on the collectionView to allow the swipeMenu to not be the root child of the template
1 parent d0e544b commit ab4addb

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/swipemenu/index.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export class CollectionViewWithSwipeMenu extends CollectionView {
2323
public static swipeMenuCloseEvent = 'swipeMenuClose';
2424
onlyOneMenuOpened;
2525
openedDrawerIndex: number;
26+
swipeMenuId: string;
2627
public setItemAtIndex(index: number, item): any {
2728
// will be overriden in onItemsChangedInternal
2829
const thisItems = this.items as ItemsSource;
@@ -55,10 +56,15 @@ export class CollectionViewWithSwipeMenu extends CollectionView {
5556
return;
5657
}
5758
const view = this.getViewForItemAtIndex(openedIndex);
58-
let drawer = view;
59-
// console.log('closeCurrentMenu', openedIndex, view, view.bindingContext);
60-
if (drawer instanceof ContentView) {
61-
drawer = drawer.content;
59+
let drawer;
60+
if (this.swipeMenuId && view) {
61+
drawer = view.getViewById(this.swipeMenuId);
62+
} else {
63+
drawer = view;
64+
// console.log('closeCurrentMenu', openedIndex, view, view.bindingContext);
65+
if (drawer instanceof ContentView) {
66+
drawer = drawer.content;
67+
}
6268
}
6369
if (drawer instanceof Drawer) {
6470
drawer.close();

0 commit comments

Comments
 (0)