我已经安装了许多字体..并且一切正常,但不是 NOTO-Fonts。我创建了一个简单的代码,向您展示问题。Licorice-Regular 和 GeoAcadNusxNormal 在 iOS 和 android 上显示得非常好。但 NOTO-Fonts 仅显示为标准字体。我以相同的方式安装了所有字体。所有字体都在 Android 和 Xcode 的正确文件夹中。我可以很好地在 Xcode 中看到正确的 NOTO-Fonts 符号。
const App = () => {
return (
<View
style={{
flex: 1,
justifyContent: "center",
alignItems: "center",
backgroundColor: "white"
}}>
<Text>Hello, world!</Text>
<Text style={{ fontFamily: 'Licorice-Regular', fontSize: 40 }}>
Google-Font fine on ios and android (Simulator and real device)
</Text>
<Text style={{ fontFamily: 'GeoAcadNusxNormal', fontSize: 40 }}>
Custom-Font fine on ios and android
</Text>
<Text style={{ fontFamily: 'NotoSansGeorgian-Medium' }}>
NOTO-Font doesn't work. Is shown as standart Font, but not georgian.
</Text>
<Text style={{ fontFamily: 'NotoSansTamil-Regular' }}>
NOTO-Font doesn't work. Is shown as standart Font, but not Tamil.
</Text>
</View>
)
}
我的 react-native.config.js 看起来像这样:
module.exports = {
project: {
ios: {},
android: {},
},
assets: ['./src/assets/fonts/'],
};
这是我的 package.json
{
"name": "Test",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest",
"lint": "eslint ."
},
"dependencies": {
"react": "17.0.2",
"react-localization": "^1.0.17",
"react-native": "0.66.4",
"react-native-mmkv": "^1.5.4",
"react-native-reanimated": "^2.3.1"
},
"devDependencies": {
"@babel/core": "^7.12.9",
"@babel/runtime": "^7.12.5",
"@react-native-community/eslint-config": "^2.0.0",
"babel-jest": "^26.6.3",
"eslint": "7.14.0",
"jest": "^26.6.3",
"metro-react-native-babel-preset": "^0.66.2",
"react-test-renderer": "17.0.2"
},
"jest": {
"preset": "react-native"
}
}