Created
April 24, 2019 06:58
-
-
Save DeVoresyah/5305249d3e668a15d21a2e7fb50fe60f to your computer and use it in GitHub Desktop.
Responsive Width & Height
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'); | |
const ScaleWidth = (scaleWidth) => { | |
const DESIGN_WIDTH = 180; | |
return (scaleWidth * width) / DESIGN_WIDTH | |
} | |
const ScaleHeight = (scaleHeight) => { | |
const DESIGN_HEIGHT = 180; | |
return (scaleHeight * height) / DESIGN_HEIGHT | |
} | |
export { | |
ScaleWidth, | |
ScaleHeight | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage