-
-
Save zdienos/1bd59af45527a0f733508851b4674749 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