sAleksovski / react-native-android-widget

Build Android Widgets with React Native
https://sAleksovski.github.io/react-native-android-widget/
MIT License
578 stars 22 forks source link

Is there a way to ignore Android system fonts #51

Closed explorer-cat closed 10 months ago

explorer-cat commented 10 months ago

I want to use 10px of text, but if I adjust the size of Android's system font, the widget also changes, causing inconvenience.

sAleksovski commented 10 months ago

10px on one device and 10px on another device can be very different.

All dimensions in React Native are unitless, and represent density-independent pixels.

This library uses sp to define text size. https://developer.android.com/guide/topics/resources/more-resources.html#Dimension

Scale-independent Pixels - This is like the dp unit, but it is also scaled by the user's font size preference. It is recommend you use this unit when specifying font sizes, so they will be adjusted for both the screen density and the user's preference.

Maybe you can try with adjustsFontSizeToFit ?

sAleksovski commented 10 months ago

I just released 0.9.0 that allows you to use allowFontScaling={false} in your TextWidget to disable scaling of the font size with the system font.