将Expo SDK版本升级到33后出现此错误:
CIQRCodeFeature
答案 0 :(得分:0)
更新Expo可能与更新后的@expo/vector-icons
产生冲突。如果native-base
模块已删除且未重新安装或问题未解决,
rm -rf node_modules && yarn install && expo start
答案 1 :(得分:0)
Expo以新的方式加载字体:
https://docs.expo.io/versions/latest/sdk/font/
以下示例基于native-base和expo docs的示例。
https://github.com/GeekyAnts/NativeBase
您可能需要先运行此程序:
expo install expo-font
然后,在您的代码中:
import * as Font from 'expo-font'
和
export default class App extends React.Component {
async componentDidMount() {
await Font.loadAsync({
'open-sans-bold': require('./assets/fonts/OpenSans-Bold.ttf'),
});
this.setState({ isReady: true });
}
// ...
}
使用native-base/Fonts/Roboto.ttf
的导入路径对我不起作用,但是使用如下所示的相对路径可以实现:
await Font.loadAsync({
Roboto: require('../node_modules/native-base/Fonts/Roboto.ttf'),
Roboto_medium: require('../node_modules/native-base/Fonts/Roboto_medium.ttf')
});
这是一个稍微完整的示例:
export default class extends React.Component {
state = {
isReady: false,
};
async componentDidMount() {
await Font.loadAsync({
Roboto: require('../node_modules/native-base/Fonts/Roboto.ttf'),
Roboto_medium: require('../node_modules/native-base/Fonts/Roboto_medium.ttf')
});
this.setState({ isReady: true });
}
render() {
if (!this.state.isReady) {
return ( <AppLoading />);
}
return <Navigator />;
}
}