2018-08-10 17:26:36 +00:00
|
|
|
import { Dimensions } from 'react-native';
|
|
|
|
|
2019-12-11 23:01:12 +00:00
|
|
|
import { isTablet } from './deviceInfo';
|
|
|
|
|
2018-08-10 17:26:36 +00:00
|
|
|
const { width, height } = Dimensions.get('window');
|
|
|
|
|
2019-12-11 23:01:12 +00:00
|
|
|
const guidelineBaseWidth = isTablet ? 600 : 375;
|
|
|
|
const guidelineBaseHeight = isTablet ? 800 : 667;
|
2018-08-10 17:26:36 +00:00
|
|
|
|
|
|
|
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 };
|