12 lines
410 B
TypeScript
12 lines
410 B
TypeScript
import { useWindowDimensions } from "react-native";
|
|
|
|
/**
|
|
* スマホ(短辺 < 600dp)のみ maxHeight を返す。タブレットでは undefined。
|
|
*/
|
|
export function useSheetMaxHeight(ratio = 0.7): number | undefined {
|
|
const { width, height } = useWindowDimensions();
|
|
const shortSide = Math.min(width, height);
|
|
if (shortSide >= 600) return undefined; // タブレット
|
|
return height * ratio;
|
|
}
|