@qeepsake/react-navigation-overlay
Version:
Don't we all wish that React Navigation had awesome Overlays like React Native Navigation ? Now it does 💪
22 lines (18 loc) • 528 B
text/typescript
import { ReactElement, RefObject } from "react";
export interface OverlayRefHandle {
show: (component: (...props: any) => ReactElement, props?: any) => void;
close: () => void;
}
/** Constants */
let OverlayRef: OverlayRefHandle | null = null;
export const Overlay = {
register: (ref: RefObject<OverlayRefHandle>) => {
OverlayRef = ref.current;
},
show: (component: (...props: any) => ReactElement, props: any) => {
OverlayRef?.show(component, props);
},
close: () => {
OverlayRef?.close();
},
};