vn-verdnaturachat/app/utils/scaling.js

15 lines
502 B
JavaScript
Raw Normal View History

import { Dimensions } from 'react-native';
2019-11-25 20:01:17 +00:00
import { isTablet } from './deviceInfo';
const { width, height } = Dimensions.get('window');
2019-11-25 20:01:17 +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 };