UNPKG

1.21 kBTypeScriptView Raw
1import * as React from 'react';
2import { TouchRippleActions } from '../ButtonBase/TouchRipple';
3type ControlledPromise<T = unknown> = Promise<T> & {
4 resolve: Function;
5 reject: Function;
6};
7/**
8 * Lazy initialization container for the Ripple instance. This improves
9 * performance by delaying mounting the ripple until it's needed.
10 */
11export declare class LazyRipple {
12 /** React ref to the ripple instance */
13 ref: React.MutableRefObject<TouchRippleActions | null>;
14 /** If the ripple component should be mounted */
15 shouldMount: boolean;
16 /** Promise that resolves when the ripple component is mounted */
17 private mounted;
18 /** If the ripple component has been mounted */
19 private didMount;
20 /** React state hook setter */
21 private setShouldMount;
22 static create(): LazyRipple;
23 static use(): LazyRipple;
24 constructor();
25 mount(): ControlledPromise<unknown>;
26 mountEffect: () => void;
27 start(...args: Parameters<TouchRippleActions['start']>): void;
28 stop(...args: Parameters<TouchRippleActions['stop']>): void;
29 pulsate(...args: Parameters<TouchRippleActions['pulsate']>): void;
30}
31export default function useLazyRipple(): LazyRipple;
32export {};