react-router-navigation-confirm
Version:
A collection of components to display a custom confirmation dialog on navigation. More flexible solution to prevent than default react-router 'Prompt'
16 lines (15 loc) • 761 B
TypeScript
/// <reference types="react" />
import { Location } from "history";
import { RouteComponentProps } from "react-router";
import { HistoryService } from "./services/history-service";
interface IHistoryServiceComponentProps {
historyService?: HistoryService;
}
interface IChildData {
onCancel: () => void;
onConfirm: () => void;
}
declare type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
declare type WhenPropType = boolean | ((location: Location, routeProps: RouteComponentProps) => boolean);
declare type NavigationConfirmChildren = (data: IChildData) => React.ReactNode;
export { Omit, WhenPropType, IHistoryServiceComponentProps as HistoryServiceComponentProps, IChildData as NavigationConfirmChildData, NavigationConfirmChildren };