简体   繁体   中英

Font Size React native

In react native app whats the best way to deal with font size.

I've a kind of weird issue, if font size is increased from mobile device display settings it changes the fontSize of app as well. I have used fontSize:14(whatever value), so it picks the size 14 according to mobile device font size & the font size of entire app get increased and UI looks horrible.

I've also tried to adjust the fontSize using width and height but it also not looks good on all devices.

const WIDTH = Dimensions.get('window').width;
const HEIGHT = Dimensions.get('window').height;

Adding allowFontScaling={false} to Text ignores the device font scaling.

 <Text allowFontScaling={false}  style={styles.TitleText}>
           {this.state.testLabel.toUpperCase()}
            </Text>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM