GoonCord/ui/sheets.ts

17 lines
515 B
TypeScript
Raw Normal View History

2025-12-10 17:20:21 +01:00
import { findByPropsLazy } from "@metro/wrappers";
const actionSheet = findByPropsLazy("openLazy", "hideActionSheet");
export function showSheet<T extends React.ComponentType<any>>(
key: string,
lazyImport: Promise<{ default: T; }> | T,
props?: React.ComponentProps<T>
) {
if (!("then" in lazyImport)) lazyImport = Promise.resolve({ default: lazyImport });
actionSheet.openLazy(lazyImport, key, props ?? {});
}
export function hideSheet(key: string) {
actionSheet.hideActionSheet(key);
}