小编Dan*_*rle的帖子

FontAwesomeIcon React 组件不接受 icon 属性

由于 Font Awesome 库的影响,我无法构建我的 React 项目。

\n

到目前为止,我一直使用带语法的图标<FontAwesomeIcon icon={faPowerOff} />,但是在尝试在 Github 上实现自动构建和部署后,出现以下错误:

\n
Type 'IconDefinition' is not assignable to type 'IconProp'.\n  Type 'IconDefinition' is not assignable to type 'IconLookup'.\n     Types of property 'iconName' are incompatible.\n
Run Code Online (Sandbox Code Playgroud)\n

奇怪的是,该图标确实使用此语法和错误进行渲染。

\n

使用<FontAwesomeIcon icon={"power-off"} />语法,我不再收到错误,但图标本身根本渲染。

\n

自项目开始以来我使用的版本:

\n
\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 @fortawesome/fontawesome-svg-core@1.3.0\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 @fortawesome/free-solid-svg-icons@5.15.4 \n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 @fortawesome/react-fontawesome@0.1.17\n
Run Code Online (Sandbox Code Playgroud)\n

有人知道如何解决这个问题吗?

\n

font-awesome typescript reactjs react-font-awesome

5
推荐指数
1
解决办法
6218
查看次数