@kietpt2003/react-native-core-ui
Version:
React Native Core UI components by KietPT
65 lines (63 loc) • 2.41 kB
JavaScript
;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/utils/scale.ts
var scale_exports = {};
__export(scale_exports, {
IPHONE_12_HEIGTH: () => IPHONE_12_HEIGTH,
IPHONE_12_WIDTH: () => IPHONE_12_WIDTH,
height: () => height,
moderateHeightScale: () => moderateHeightScale,
moderateScale: () => moderateScale,
scale: () => scale,
scaleAvg: () => scaleAvg,
scaleFont: () => scaleFont,
scaleH: () => scaleH,
scaleHeight: () => scaleHeight,
scaleWidth: () => scaleWidth,
width: () => width
});
module.exports = __toCommonJS(scale_exports);
var import_react_native = require("react-native");
var { width, height } = import_react_native.Dimensions.get("window");
var IPHONE_12_WIDTH = 375;
var IPHONE_12_HEIGTH = 812;
var scaleWidth = width / IPHONE_12_WIDTH;
var scaleHeight = height / IPHONE_12_HEIGTH;
var scaleAvg = (scaleWidth + scaleHeight) / 2;
var scaleFont = (size) => Math.round(import_react_native.PixelRatio.roundToNearestPixel(size * scaleAvg));
var scale = (size) => Math.round(import_react_native.PixelRatio.roundToNearestPixel(size * scaleWidth));
var scaleH = (size) => Math.round(import_react_native.PixelRatio.roundToNearestPixel(size * scaleHeight));
var moderateScale = (size, factor = 0.5) => size + (scale(size) - size) * factor;
var moderateHeightScale = (size, factor = 0.5) => size + (scaleH(size) - size) * factor;
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
IPHONE_12_HEIGTH,
IPHONE_12_WIDTH,
height,
moderateHeightScale,
moderateScale,
scale,
scaleAvg,
scaleFont,
scaleH,
scaleHeight,
scaleWidth,
width
});
//# sourceMappingURL=scale.js.map