NervJS / taro

开放式跨端跨框架解决方案,支持使用 React/Vue/Nerv 等框架来开发微信/京东/百度/支付宝/字节跳动/ QQ 小程序/H5/React Native 等应用。 https://taro.zone/
https://docs.taro.zone/
Other
35.41k stars 4.78k forks source link

3.6.1使用阿里云iconfont报错 #13343

Open fanlvwen opened 1 year ago

fanlvwen commented 1 year ago

相关平台

React Native

使用框架: React

复现步骤

1.正常下载iconfont.scss到项目中 2.app.ts引用iconfont.scss 3.run alipay正常显示,yarn start 运行rn报错 Unexpected token type: div Failed to parse declaration "fontFamily: "iconfont"

期望结果

与小程序同步正常展示iconfont

实际结果

rn端报错无法运行

环境信息

Taro CLI 3.6.1 environment info:
    System:
      OS: Windows 10
    Binaries:
      Node: 16.9.1 - D:\nodejs\node.EXE
      Yarn: 1.22.19 - D:\nodejs\yarn.CMD
      npm: 7.21.1 - D:\nodejs\npm.CMD

补充信息

iconfont.scss如下 @font-face { font-family: "iconfont"; / Project id 1065077 / src: url('//at.alicdn.com/t/c/font_1065077_btnez6valf.woff2?t=1665563885988') format('woff2'), url('//at.alicdn.com/t/c/font_1065077_btnez6valf.woff?t=1665563885988') format('woff'), url('//at.alicdn.com/t/c/font_1065077_btnez6valf.ttf?t=1665563885988') format('truetype'); }

.iconfont { font-family: "iconfont" !important; font-style: normal; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

.iconanquan:before { content: "\e8ab"; }

fanlvwen commented 1 year ago

image

yoyo837 commented 1 year ago

React Native 不识别自定义的字体名, 是不是并非iconfont问题?

fanlvwen commented 1 year ago

React Native 不识别自定义的字体名, 是不是并非iconfont问题?

image iconfont下载下来之后,默认就是这个名字,小程序正常识别的,rn不行

fanlvwen commented 1 year ago

React Native 不识别自定义的字体名, 是不是并非iconfont问题?

主要是不识别font-family后面这个iconfont,把它换成任何字符串都是报错的 @yoyo837

yoyo837 commented 1 year ago

换成行业常见的字体名能正常吗?

fanlvwen commented 1 year ago

换成行业常见的字体名能正常吗? 主要是不识别font-family后面这个iconfont,把iconfont换成任何字符串都是报错的 @yoyo837