// 全局设置text组件的fontFamily
import React, { Component } from 'react';
import { View, Platform, Text } from 'react-native';
const defaultFontFamily = { ...Platform.select({ android: { fontFamily: '' } }) };
const oldRender = Text.render;
Text.render = function(...args) {
const origin = oldRender.call(this, ...args);
return React.cloneElement(origin, {
style: [defaultFontFamily, origin.props.style]
});
};
网友评论