@vgbire/react-keep-alive
Version:
React keepAlive
41 lines (40 loc) • 1.31 kB
TypeScript
import React, { ReactNode, FC, CSSProperties } from 'react';
import { TabsItem, CachesItem, LifeCircle } from '../types';
type LifeCircles = {
[key: string]: Array<LifeCircle>;
};
interface RouterKeepAliveContext {
activateds: LifeCircles;
setActivateds?: (activateds: LifeCircles) => void;
deactivateds: LifeCircles;
setDeactivateds?: (deactivateds: LifeCircles) => void;
active?: string;
setActive?: (active: string) => void;
tabs?: TabsItem[];
setTabs?: (tabs: TabsItem[]) => void;
caches?: CachesItem[];
setCaches?: (caches: CachesItem[]) => void;
nameKey?: string;
cacheMaxRemove?: boolean;
theme?: 'light' | 'dark';
size?: 'small' | 'middle' | 'large';
max?: number;
}
declare const RouterKeepAliveContext: React.Context<RouterKeepAliveContext>;
interface RouterKeepAliveProps {
mode?: 'path' | 'search';
nameKey?: string;
cacheMaxRemove?: boolean;
theme?: 'light' | 'dark';
size?: 'small' | 'middle' | 'large';
max?: number;
custom?: boolean;
bodyStyles?: {
wrapper?: CSSProperties;
content?: CSSProperties;
};
children: ReactNode;
}
export declare const RouterKeepAlive: FC<RouterKeepAliveProps>;
export declare const useKeepAliveContext: () => RouterKeepAliveContext;
export {};