template_0205

This commit is contained in:
Sofio
2026-02-05 13:16:05 +08:00
commit d93e4d9c9f
197 changed files with 52810 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
import { Dimensions, PixelRatio } from "react-native"
const DESIGN_WIDTH = 400
const { width: SCREEN_WIDTH } = Dimensions.get("window")
/** 布局尺寸缩放padding、margin、width、height、borderRadius 等) */
export function s(size: number): number {
return PixelRatio.roundToNearestPixel(size * (SCREEN_WIDTH / DESIGN_WIDTH))
}
/** 字体缩放(平方根阻尼,避免大屏字体过大) */
export function fs(size: number): number {
return PixelRatio.roundToNearestPixel(size * Math.pow(SCREEN_WIDTH / DESIGN_WIDTH, 0.5))
}