Last active
February 22, 2019 16:45
-
-
Save mutablestudio/9e0ca3b1199b8c1706895b8f635345cd to your computer and use it in GitHub Desktop.
react-native size class func
This file contains hidden or 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
export const isMediumHeight = height < 750 && height >= 600 | |
export const isSmallHeight = width < 600 | |
export const setImageScale = (size, type) => { | |
console.log(`smallImageScale height ${height} size ${size} type ${type}`) | |
switch(true) { | |
case isMediumHeight: | |
reduceBy = type === 'large' ? .55 : .85 | |
return Math.round(size * reduceBy); | |
case isSmallHeight: | |
reduceBy = type === 'large' ? .25 : .65 | |
return Math.round(size * reduceBy); | |
default: | |
return size; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment