Last active
January 22, 2019 12:17
-
-
Save IgorHalfeld/3fe696af69118ed4777c6728a1c825ac to your computer and use it in GitHub Desktop.
Create a responsive font size on React Native
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
| import { Dimensions } from 'react-native'; | |
| export const { width, height } = Dimensions.get('screen'); | |
| export const fontSizeResponsive = value => { | |
| const tempHeight = (16 / 9) * width; | |
| return ( | |
| Math.sqrt(Math.pow(tempHeight, 2) + Math.pow(width, 2)) * (value / 100) | |
| ); | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment