Last active
February 12, 2018 12:17
-
-
Save rafaelmotta/1fc1d6e2c720c5578988b59d7bf867bf to your computer and use it in GitHub Desktop.
React Native Scale
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 dimensions = Dimensions.get('window'); | |
const { width, height } = dimensions; | |
const guidelineBaseWidth = 350; | |
const guidelineBaseHeight = 680; | |
export const scale = size => (width / guidelineBaseWidth) * size; | |
export const verticalScale = size => (height / guidelineBaseHeight) * size; | |
export const moderateScale = (size, factor = 0.5) => size + ((scale(size) - size) * factor); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment