import { Dimensions, Platform } from 'react-native'; const BASE_WIDTH = 390; // Based on iPhone 13's viewport size const horizontalScale = (size: number) => { if (Platform.OS === 'web') { return size; } const { width, height } = Dimensions.get('window'); const shortDimension = width < height ? width : height; return (shortDimension / BASE_WIDTH) * size; }; export const scale = (size: number, factor = 0.5) => size + (horizontalScale(size) - size) * factor;