我已将我的项目更新到 Expo SDK 51,矢量图标停止工作。当我从 Expo Go 启动项目时,它不再显示图标。
我尝试按照网上的建议更新 babel 配置:
module.exports = function (api) {
api.cache(true)
return {
presets: ['babel-preset-expo'],
plugins: [
'react-native-reanimated/plugin',
'transform-inline-environment-variables',
[
'module-resolver',
{
alias: {
'@': './src',
'^react-native-vector-icons(/.*)?$': '@expo/vector-icons$1',
},
},
],
],
env: {
production: {
plugins: ['react-native-paper/babel'],
},
},
}
}
我确实喜欢这个,
<SymbolView
name="camera.viewfinder"
tintColor={color}
size={18}
fallback={
<FontAwesome6 size={16} name="camera" color={color} />
}
/>
希望有帮助。