13 lines
426 B
JavaScript
13 lines
426 B
JavaScript
|
import { Dimensions } from 'react-native';
|
||
|
|
||
|
const { width, height } = Dimensions.get('window');
|
||
|
|
||
|
const guidelineBaseWidth = 375;
|
||
|
const guidelineBaseHeight = 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 };
|