forked from mpiannucci/react-native-context-menu-view
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
59 lines (55 loc) · 1.8 KB
/
index.d.ts
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
59
import { Component } from 'react';
import { NativeSyntheticEvent, ViewProps, ViewStyle } from 'react-native';
export interface ContextMenuAction {
/**
* The title of the action
*/
title: string;
/**
* The icon to use on ios. This is the name of the SFSymbols icon to use. On Android nothing will happen if you set this option.
*/
systemIcon?: string;
/**
* Destructive items are rendered in red on iOS, and unchanged on Android. (default: false)
*/
destructive?: boolean;
/**
* Whether the action is disabled or not (default: false)
*/
disabled?: boolean;
/**
* Whether its children (if any) should be rendered inline instead of in their own child menu (default: false, iOS only)
*/
inlineChildren?: boolean;
/**
* Child actions. When child actions are supplied, the childs callback will contain its name but the same index as the topmost parent menu/action index. (iOS Only)
*/
actions?: Array<ContextMenuAction>;
}
export interface ContextMenuOnPressNativeEvent {
index: number;
name: string;
}
export interface ContextMenuProps extends ViewProps {
/**
* The title of the menu
*/
title?: string;
/**
* The actions to show the user when the menu is activated
*/
actions?: Array<ContextMenuAction>;
/**
* Handle when an action is triggered and the menu is closed. The name of the selected action will be passed in the event.
*/
onPress?: (e: NativeSyntheticEvent<ContextMenuOnPressNativeEvent>) => void;
/**
* Handle when the menu is cancelled and closed
*/
onCancel?: () => void;
/**
* The background color of the preview. This is displayed underneath your view. Set this to transparent (or another color) if the default causes issues.
*/
previewBackgroundColor?: ViewStyle["backgroundColor"];
}
export default class ContextMenu extends Component<ContextMenuProps> { }