Skip to content

Instantly share code, notes, and snippets.

@IgorHalfeld
Last active January 22, 2019 12:17
Show Gist options
  • Select an option

  • Save IgorHalfeld/3fe696af69118ed4777c6728a1c825ac to your computer and use it in GitHub Desktop.

Select an option

Save IgorHalfeld/3fe696af69118ed4777c6728a1c825ac to your computer and use it in GitHub Desktop.
Create a responsive font size on React Native
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