forked from Kureev/react-native-side-menu
-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathindex.d.ts
97 lines (94 loc) · 3.06 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
// Type definitions for react-native-side-menu 1.1
// Project: https://github.com/react-native-community/react-native-side-menu#readme
// Definitions by: Jules Samuel Randolph <https://github.com/jsamr>
// Matt Pawley <https://github.com/toughdeveloper>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import { ReactNode, Component } from 'react';
import { GestureResponderEvent, PanResponderGestureState, Animated, ViewStyle } from 'react-native';
export interface ReactNativeSideMenuProps {
/**
* Menu component
*/
menu: ReactNode;
/**
* Props driven control over menu open state
* @default false
*/
isOpen?: boolean;
/**
* Content view left margin if menu is opened
*/
openMenuOffset?: number;
/**
* Content view left margin if menu is hidden
*/
hiddenMenuOffset?: number;
/**
* Edge distance on content view to open side menu, defaults to 60
*/
edgeHitWidth?: number;
/**
* X axis tolerance
*/
toleranceX?: number;
/**
* Y axis tolerance
*/
toleranceY?: number;
/**
* Disable whether the menu can be opened with gestures or not
* @default false
*/
disableGestures?: boolean;
/**
* Function that accepts event as an argument and specify if side-menu should react on the touch or not.
* Check https://facebook.github.io/react-native/docs/gesture-responder-system.html for more details
*/
onStartShouldSetResponderCapture?: (e: GestureResponderEvent) => boolean;
/**
* Callback on menu open/close. Is passed isOpen as an argument
*/
onChange?: (isOpen: boolean) => void;
/**
* Callback on menu move. Is passed left as an argument
*/
onMove?: (left: number) => void;
/**
* Callback when menu is sliding. It returns a decimal from 0 to 1 which represents the percentage of menu offset between hiddenMenuOffset and openMenuOffset.
*/
onSliding?: (fraction: number) => void;
/**
* @default left
*/
menuPosition?: 'left' | 'right';
animationFunction?: (prop: Animated.Value, value: number) => Animated.CompositeAnimation;
animationStyle?: (value: number) => ViewStyle;
/**
* Callback when menu animation has completed.
*/
onAnimationComplete?: (event: Animated.EndCallback) => void;
/**
* When true, content view will bounce back to openMenuOffset when dragged further
* @default true
*/
bounceBackOnOverdraw?: boolean;
/**
* When true, menu close automatically as soon as an event occurs
* @default true
*/
autoClosing?: boolean;
/**
* When true, press events on the overlay can be propagated to the buttons inside your page
* @default false
*/
allowOverlayPressPropagation?: boolean;
/**
* Page overlay color when sidebar open
* @default transparent
*/
overlayColor?: string
}
export default class SideMenu extends Component<ReactNativeSideMenuProps> {
openMenu(isOpen: boolean): void;
moveLeft(offset: number): void;
}