ant-design-icons icon indicating copy to clipboard operation
ant-design-icons copied to clipboard

unrecognized font family 'antoutline'

Open boatlet opened this issue 4 years ago • 7 comments

react-native > 0.60,官方说是会有autolink, 然后就没有经过手动link过,在使用的时候报错:unrecognized font family 'antoutline'; 使用代码: <IconOutline name="account-book" />

boatlet avatar Aug 21 '20 07:08 boatlet

一样的问题. 首先npm install @ant-design/icons-react-native 之后react-native run-ios 报错unrecognized font family 'antfill'

haobrother avatar Aug 25 '20 06:08 haobrother

maybe you will need run ' pod install ' before run in ios

yonglinwang002 avatar Nov 26 '20 08:11 yonglinwang002

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?

JoshWalshaw avatar Mar 11 '21 18:03 JoshWalshaw

短期解决方案:

  1. 在 scripts(没有就自己建)下创建文件 icon-fix.js
  2. 添加内容:
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)
}
  1. node scripts/icon-fix.js
  2. 重新 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
  1. 重新运行

此方案在 #429 这个 PR 合并后可以不再使用

Grewer avatar Mar 20 '21 06:03 Grewer

+1

askie avatar Nov 28 '21 07:11 askie

+1

zhonggithub avatar Dec 03 '21 02:12 zhonggithub

+1

zhonggithub avatar Dec 06 '21 15:12 zhonggithub