-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Expand file tree
/
Copy pathReorderGroup.tsx
More file actions
58 lines (54 loc) · 1.44 KB
/
ReorderGroup.tsx
File metadata and controls
58 lines (54 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import React from 'react';
import {
IonBackButton,
IonButtons,
IonContent,
IonHeader,
IonItem,
IonLabel,
IonPage,
IonReorder,
IonReorderGroup,
IonTitle,
IonToolbar,
} from '@ionic/react';
import type { ReorderEndCustomEvent } from '@ionic/react';
const ReorderGroup: React.FC = () => {
const onReorderEnd = (event: ReorderEndCustomEvent) => {
if (event.detail.from !== event.detail.to) {
console.log('ionReorderEnd: Dragged from index', event.detail.from, 'to', event.detail.to);
} else {
console.log('ionReorderEnd: No position change occurred');
}
event.detail.complete();
};
return (
<IonPage>
<IonHeader>
<IonToolbar>
<IonButtons slot="start">
<IonBackButton></IonBackButton>
</IonButtons>
<IonTitle>Reorder Group</IonTitle>
</IonToolbar>
</IonHeader>
<IonContent>
<IonReorderGroup disabled={false} onIonReorderEnd={onReorderEnd}>
<IonItem>
<IonReorder slot="end"></IonReorder>
<IonLabel>Item 1</IonLabel>
</IonItem>
<IonItem>
<IonReorder slot="end"></IonReorder>
<IonLabel>Item 2</IonLabel>
</IonItem>
<IonItem>
<IonReorder slot="end"></IonReorder>
<IonLabel>Item 3</IonLabel>
</IonItem>
</IonReorderGroup>
</IonContent>
</IonPage>
);
};
export default ReorderGroup;