UNPKG

react-native-template-by-nh

Version:

React Native Template for a quick start with TypeScript using best existing libraries and scalable structure

16 lines (11 loc) 695 B
import {Dimensions} from 'react-native'; export const {width, height} = Dimensions.get('window'); //Guideline sizes are based on standard around 5 inches screen mobile device export const guidelineBaseWidth = 326; export const guidelineBaseHeight = 680; // Will return a linear scaled result of the provided size, based on your device's screen width. export const horizontalScale = (size: number): number => parseFloat(((width / guidelineBaseWidth) * size).toFixed(2)); // Will return a linear scaled result of the provided size, based on your device's screen height. export const verticalScale = (size: number): number => parseFloat(((height / guidelineBaseHeight) * size).toFixed(2));