forked from TreeNewbie/react-native-popup-stub
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.d.ts
111 lines (96 loc) · 2.58 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
import react, { Component, ReactElement } from 'react'
type UUID = string
export type PopupStubOption = {
id?: UUID;
// priority
zIndex: number;
// animation related
animation?: string | object;
closingAnimation?: string | object;
delay?: number;
duration?: number;
direction?: 'normal' | 'reverse' | 'alternate'| 'alternate-reverse';
easing?: string;
// interactive related
autoClose?: boolean;
lock?: boolean;
mask?: boolean;
maskDuration?: number;
visible?: boolean;
// style related
position?: 'center' | 'none' | 'top' | 'right' | 'bottom' | 'left';
wrapperStyle?: object;
// lifecycle
onAdded?: Function;
onClosed?: Function;
}
export type PopupInstance = PopupStubOption & {
// if is closing
_closing?: boolean;
// react element
_element: ReactElement<any>;
}
interface PopupStupProps {
// Ref handler
ref: (o: React.Ref<PopupStubStatic>) => void;
// mask color for all popups
maskColor?: string;
// whether enable mask animation
maskAnimatable?: boolean;
}
interface PopupStubStatic extends Component<PopupStupProps> {
/*
* Ref. Do Not Use It Directly.
*/
stub: React.Ref<PopupStubStatic>;
/**
* Initialize PopupStub instance
*
* This static method **MUST** be called once before any other methods of PopupStub is called. e.g:
* <PopupStub ref={ref => if (ref) PopupStub.init(ref)} />
*
*/
init (ref: React.Ref<PopupStubStatic>): void;
/**
* Return true if any popup is displaying, otherwise return false
* Will always skip unvisible popups
*
* @param filter - return true as isShow
*/
isShow (filter?: (o: PopupInstance) => boolean): boolean;
/**
* Create an unique id with UUID algorithm
*/
getNewId (): UUID;
/**
* Show popup to display passed in content view according to options
*
* @param element - Any react element
* @param option
* @returns an unique id to indentify the new PopupStub element
*/
addPopup (element: ReactElement<any>, option?: PopupStubOption): UUID;
/**
* Remove specified popup with animation
*
* @param id
* @param forceUpdate - default true
*/
removePopup(id?: UUID, forceUpdate?: boolean): void;
/**
* Remove specified popup immediately
*/
removePopupImmediately(id?: UUID): boolean;
/**
* Reset property of specified popup
*/
resetPopupProperty(id?: UUID, key?: string, value?: any): void;
/*
* Remove popups by filter
*
* @param filter - return true to remove
*/
removeAll (filter?: (o: PopupInstance) => boolean): void;
}
declare var PopupStub: PopupStubStatic
export { PopupStub }