美文网首页
react-native 字体大小不跟随系统和处理部分安卓机文

react-native 字体大小不跟随系统和处理部分安卓机文

作者: Biao_349d | 来源:发表于2023-10-25 11:05 被阅读0次

import { setCustomText, setCustomTextInput } from 'react-native-global-props'
import { TEXT_COLOR } from '../config/theme'
import { Platform, Text, TextInput, StyleSheet } from 'react-native'

const customTextProps = {
  style: {
    color: TEXT_COLOR.default,
    ...Platform.select({
      android: { fontFamily: '' } // 处理安卓部分机型文字显示不全的问题
    })
  }
}
//
Text.defaultProps = Object.assign({}, Text.defaultProps, {
  allowFontScaling: false
})

TextInput.defaultProps = Object.assign({}, TextInput.defaultProps, {
  allowFontScaling: false
})

export default function init() {
  setCustomText(customTextProps)
}


相关文章

网友评论

      本文标题:react-native 字体大小不跟随系统和处理部分安卓机文

      本文链接:https://www.haomeiwen.com/subject/pfeeidtx.html