Last active
July 24, 2017 10:20
-
-
Save nirsky/17b95fc07332bcce64cdb6916a4f271e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Dimensions } from 'react-native'; | |
const { width, height } = Dimensions.get('window'); | |
//Guideline sizes are based on standard ~5" screen mobile device | |
const guidelineBaseWidth = 350; | |
const guidelineBaseHeight = 680; | |
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}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment