尝试在Android上加载Android for Android(iOS上工作)
时遇到此问题似乎导入'react-native'
不起作用。我已经运行npm install
这是导致错误的文件:
import { Text } from 'react-native'
import DebugConfig from './DebugConfig'
import AppConfig from './AppConfig'
// Allow/disallow font-scaling in app
Text.defaultProps.allowFontScaling = AppConfig.allowTextFontScaling
if (__DEV__) {
// If ReactNative's yellow box warnings are too much, it is possible to turn
// it off, but the healthier approach is to fix the warnings. =)
console.disableYellowBox = !DebugConfig.yellowBox
}
在反应本机0.57.5
上测试text.defaultProps.AllowFontScaling在0.57.5中未定义所以我尝试了以下一个。
Text.defaultProps = Text.defaultProps || {};
Text.defaultProps.allowFontScaling = false;
尝试更改
Text.defaultProps.allowFontScaling = AppConfig.allowTextFontScaling
to
Text.allowFontScaling = AppConfig.allowTextFontScaling .
如果这不起作用,则必须在所有文本实例上明确设置允许fontscaling = false