verdnatura-chat/app/utils/scaling.js

15 lines
502 B
JavaScript
Raw Normal View History

import { Dimensions } from 'react-native';
2019-12-11 23:01:12 +00:00
import { isTablet } from './deviceInfo';
const { width, height } = Dimensions.get('window');
2019-12-11 23:01:12 +00:00
const guidelineBaseWidth = isTablet ? 600 : 375;
const guidelineBaseHeight = isTablet ? 800 : 667;
const scale = size => (width / guidelineBaseWidth) * size;
const verticalScale = size => (height / guidelineBaseHeight) * size;
const moderateScale = (size, factor = 0.5) => size + ((scale(size) - size) * factor);
export { scale, verticalScale, moderateScale };