-
Notifications
You must be signed in to change notification settings - Fork 12
Better scaling calculations #13
Copy link
Copy link
Open
Description
Hey,
I started off with this library but the tablet size was way off compared to the phone...I fixed it with this aspect ratio calculation...please consider updating this library
import { Dimensions, Platform, PixelRatio } from 'react-native';
const {
width,
height,
} = Dimensions.get('window');
export function normalize(size, multiplier = 2) {
const scale = (width / height) * multiplier;
const newSize = size * scale;
return Math.round(PixelRatio.roundToNearestPixel(newSize));
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels