forked from dominicstop/react-native-ios-context-menu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ContextMenuViewTest09.tsx
49 lines (44 loc) · 1.36 KB
/
ContextMenuViewTest09.tsx
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
import * as React from 'react';
import { ContextMenuView } from 'react-native-ios-context-menu';
import type { ContextMenuExampleProps } from './SharedExampleTypes';
import { ContextMenuCard } from '../components/ContextMenuCard';
export function ContextMenuViewTest09(props: ContextMenuExampleProps) {
const [counter, setCounter] = React.useState(0);
return (
<ContextMenuView
style={props.style}
menuConfig={{
menuTitle: 'ContextMenuViewTest09',
menuItems: [{
actionKey : 'key-01',
actionTitle: `Counter: ${counter}`,
}, {
type: 'deferred',
deferredID: `deferred-a-${counter}`
}, {
type: 'deferred',
deferredID: `deferred-b-${counter}`
}, {
type: 'deferred',
deferredID: `deferred-c-${counter}`
}, {
type: 'deferred',
deferredID: `deferred-d-${counter}`
}]
}}
onMenuDidHide={() => {
setCounter(prevCount => prevCount + 1);
}}
>
<ContextMenuCard
index={props.index}
title={'ContextMenuViewTest09'}
subtitle={'Deferred Elements - Cleanup'}
description={[
`Generate new 'deferredID' everytime the context menu is shown/hide. `
+ `Test for 'cleanupOrphanedDeferredElements'.`
]}
/>
</ContextMenuView>
);
};