Files
discord-decomp/_bundle/Module5362.js
T
2026-11-01 12:12:55 +02:00

27 lines
1.8 KiB
JavaScript

// Metro module 5362 (f5363).
import { useMemo } from "react";
import Module38 from "./Module38";
import { INITIAL_SNAP_POINT } from "./Module5249";
export const usePropsValidator = ({ index, snapPoints, enableDynamicSizing, topInset, bottomInset }) => {
useMemo(() => {
const r7 = snapPoints ? "get" in snapPoints ? snapPoints.get() : snapPoints : [];
Module38(r7 || enableDynamicSizing, "'snapPoints' was not provided! please provide at least one snap point.");
r7.map((item) => {
const r6 = typeof item !== "number" ? Number.parseInt(item.replace("%", ""), 10) : item;
Module38(r6 > 0 || r6 === INITIAL_SNAP_POINT, `Snap point '${item}' is invalid. if you want to allow user to close the sheet, Please use 'enablePanDownToClose' prop.`);
});
Module38("value" in r7 || r7.length > 0 || enableDynamicSizing, "'snapPoints' was provided with no points! please provide at least one snap point.");
Module38(typeof index !== "number" ? index === void 0 : typeof index === "number", "'index' was provided but with wrong type ! expected type is a number.");
let r36 = enableDynamicSizing;
if (!enableDynamicSizing) {
r36 = typeof index !== "number";
}
if (!r36) {
r36 = index >= -1 && index <= r7.length - 1;
}
Module38(r36, "'index' was provided but out of the provided snap points range! expected value to be between -1, " + (r7.length - 1));
Module38(typeof topInset !== "number" ? topInset === void 0 : typeof topInset === "number", "'topInset' was provided but with wrong type ! expected type is a number.");
Module38(typeof bottomInset !== "number" ? bottomInset === void 0 : typeof bottomInset === "number", "'bottomInset' was provided but with wrong type ! expected type is a number.");
}, [index, snapPoints, topInset, bottomInset, enableDynamicSizing]);
};