How to make font size responsive in React Native using NativeWind

132 Views Asked by At

I need to make text phrase to be fit in one line by using nativewind based on height and width of the screen here is my code

<Text className="text-base md:text-xl">Agree to our Terms and Privacy Policy </Text>

I tried to add custome size to nativewind by depending on height and width of the screen but didn't work with me

enter image description here

1

There are 1 best solutions below

0
user18309290 On

Use the combination of numberOfLines and adjustsFontSizeToFit to fit a text in the one line. Something like this:

<Text numberOfLines={1} adjustsFontSizeToFit={true} ...>
  Agree to our Terms and Privacy Policy
</Text>