ant-design / ant-design-icons

⭐ Ant Design SVG Icons
https://ant.design/components/icon/
MIT License
965 stars 584 forks source link

unrecognized font family 'antoutline' #358

Open boatlet opened 4 years ago

boatlet commented 4 years ago

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

haobrother commented 4 years ago

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

yonglinwang002 commented 4 years ago

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

JoshWalshaw commented 3 years ago

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?

Grewer commented 3 years ago

短期解决方案:

  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) }

3. `node scripts/icon-fix.js` 
4. 重新 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


5. 重新运行

此方案在 #429  这个 PR 合并后可以不再使用
askie commented 3 years ago

+1

zhonggithub commented 2 years ago

+1

zhonggithub commented 2 years ago

+1