Home > Software design >  How to set font size for different screen size in webapp created by react-native?
How to set font size for different screen size in webapp created by react-native?

Time:10-13

I'm making web-app using react-native. But stuck on font-size for different screen-size.

How can I change the different font-size for different screen resolution?

CodePudding user response:

Dimension from 'react-native' gives you access to the device dimensions. You could use these to set fontSize conditionally.

import { Dimensions } from "react-native";

const screenWidth = Dimensions.get("screen").width;
const screenHeight = Dimensions.get("screen").height;

How you use these to set the fontSize would be up to you.

CodePudding user response:

You can use a react-native package for handle the responsiveness of fonts and hight , width also

Package name:

npm i react-native-responsive-screen
  • Related