我升级到 expo 34.0.3 和相关的依赖项如下
"dependencies": {
"@expo/samples": "3.0.3",
"@expo/vector-icons": "^10.0.3",
"add": "^2.0.6",
"expo": "^34.0.3",
"expo-asset": "^5.0.1",
"expo-font": "~6.0.1",
"moment": "^2.24.0",
"react": "16.8.3",
"react-native": "https://github.com/expo/react-native/archive/sdk-34.0.0.tar.gz",
"react-native-gesture-handler": "^1.3.0",
"react-native-modal": "^11.3.1",
"react-native-modal-datetime-picker": "^7.5.0",
"react-native-snackbar-component": "^1.1.0",
"react-navigation": "^3.11.1",
"react-redux": "^7.1.0",
"redux": "^4.0.4",
"redux-persist": "^5.10.0"
},
Run Code Online (Sandbox Code Playgroud)
我的 App.js 大概像这样正确地预加载了字体
import * as Font from 'expo-font';
import * as Icon from '@expo/vector-icons';
.........
_loadResourcesAsync = async () => {
return Promise.all([
Font.loadAsync({
...Icon.Ionicons.font,
...Icon.MaterialCommunityIcons.font,
}),
]);
};
Run Code Online (Sandbox Code Playgroud)
现在要明确一点,这段代码在世博升级之前工作得很好。此问题在 Android 和 iOS 设备上都存在。