React Native Responsive Font Size
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: 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. 回答1: You can use PixelRatio for example: var React = require('react-native'); var {StyleSheet, PixelRatio} = React; var FONT_BACK_LABEL = 18; if (PixelRatio.get() Edit: Another example: import { Dimensions, Platform, PixelRatio } from 'react-native'; const { width: SCREEN_WIDTH, height: SCREEN_HEIGHT, } = Dimensions.get('window'); // based on iphone 5s's scale const scale = SCREEN_WIDTH /