React Native Responsive Font Size

前端 未结 14 1252
执念已碎
执念已碎 2020-11-29 16:39

I would like to ask how react native handle or do the responsive font. For example in iphone 4s i Have fontSize: 14, while in iphone 6 I have fontSize: 18.

14条回答
  •  Happy的楠姐
    2020-11-29 16:58

    You can use something like this.

    var {height, width} = Dimensions.get('window'); var textFontSize = width * 0.03;

    inputText: {
        color : TEXT_COLOR_PRIMARY,
        width: '80%',
        fontSize: textFontSize
    }
    

    Hope this helps without installing any third party libraries.

提交回复
热议问题