ant-design-icons
ant-design-icons copied to clipboard
unrecognized font family 'antoutline'
react-native > 0.60,官方说是会有autolink, 然后就没有经过手动link过,在使用的时候报错:unrecognized font family 'antoutline'; 使用代码: <IconOutline name="account-book" />
一样的问题. 首先npm install @ant-design/icons-react-native 之后react-native run-ios 报错unrecognized font family 'antfill'
maybe you will need run ' pod install ' before run in ios
I'm also getting a similar error for antfill. I've installed the package with yarn add @ant-design/icons-react-native
followed by a react-native link @ant-design/icons-react-native
which doesn't output anything like other packages...
react-native link @ant-design/icons-react-native warn Calling react-native link [packageName] is deprecated in favor of autolinking. It will be removed in the next major release. Autolinking documentation: https://github.com/react-native-community/cli/blob/master/docs/autolinking.md (node:85937) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency (Use
node --trace-warnings ...
to show where the warning was created)
A pod install
or pod update
doesn't install anything additionally from what I can see either. A little unsure what else to do, any thoughts?
短期解决方案:
- 在 scripts(没有就自己建)下创建文件
icon-fix.js
- 添加内容:
const fs = require('fs')
try {
console.log('antd icon fix...')
const rootDir = process.cwd()
const file = `${rootDir}/node_modules/@ant-design/icons-react-native/react-native.config.js`
const data = `
module.exports = {
dependency: {
assets: ['fonts']
}
};
`
fs.writeFileSync(file, data, 'utf8')
console.log('Fixed Done')
} catch (error) {
console.error(error)
}
-
node scripts/icon-fix.js
- 重新 link
react-native link @ant-design/icons-react-native
, 可以看到如下输出:
warn Calling react-native link [packageName] is deprecated in favor of autolinking. It will be removed in the next major release.
Autolinking documentation: https://github.com/react-native-community/cli/blob/master/docs/autolinking.md
info Linking assets to ios project
warn Group 'Resources' does not exist in your Xcode project. We have created it automatically for you.
info Linking assets to android project
success Assets have been successfully linked to your project
- 重新运行
此方案在 #429 这个 PR 合并后可以不再使用
+1
+1
+1