PortalWrapper.d.ts
1.59 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
import * as React from 'react';
import { PortalRef } from './Portal';
/** @private Test usage only */
export declare function getOpenCount(): number;
export declare type GetContainer = string | HTMLElement | (() => HTMLElement);
export interface PortalWrapperProps {
visible?: boolean;
getContainer?: GetContainer;
wrapperClassName?: string;
forceRender?: boolean;
children: (info: {
getOpenCount: () => number;
getContainer: () => HTMLElement;
switchScrollingEffect: () => void;
ref?: (c: any) => void;
}) => React.ReactNode;
}
declare class PortalWrapper extends React.Component<PortalWrapperProps> {
container?: HTMLElement;
componentRef: React.RefObject<PortalRef>;
rafId?: number;
renderComponent?: (info: {
afterClose: Function;
onClose: Function;
visible: boolean;
}) => void;
componentDidMount(): void;
componentDidUpdate(prevProps: PortalWrapperProps): void;
updateOpenCount: (prevProps?: Partial<PortalWrapperProps>) => void;
componentWillUnmount(): void;
attachToParent: (force?: boolean) => boolean;
getContainer: () => HTMLElement;
setWrapperClassName: () => void;
removeCurrentContainer: () => void;
/**
* Enhance ./switchScrollingEffect
* 1. Simulate document body scroll bar with
* 2. Record body has overflow style and recover when all of PortalWrapper invisible
* 3. Disable body scroll when PortalWrapper has open
*
* @memberof PortalWrapper
*/
switchScrollingEffect: () => void;
render(): any;
}
export default PortalWrapper;