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