React Native使用antd库报警告
# 警告
warn Package @ant-design/react-native contains invalid configuration: "dependency.assets" is not allowed. Please verify it's properly linked using "react-native config" command and contact the package maintainers about this.
1
# 解决方法
npm I react-native-asset
配置文件react-native.config.js
module.exports = { assets: ["node_modules/@ant-design/icons-react-native/fonts"] };
1
2
3添加到 app.json 中
"packagerOpts": { "config": "metro.config.js" }
1
2
3npx react-native-asset
更新
Package @ant-design/react-native
依赖项的[react-native.config.js]
文件dependency: { assets: ['../icons-react-native/fonts'], }, // 替换为 module.exports = { project: { ios: {}, android: { sourceDir: './<project_name>/android' } }, assets: ['../<project_name>/fonts'] };
1
2
3
4
5
6
7
8
9
10
11
12
13
14更新 icon-react-native 的 node_modules 内的依赖关系:
module.exports = { project: { ios: {}, android: {} }, assets: ['fonts'] };
1
2
3
4
5
6
7
上次更新: 2024/08/14, 04:14:33