【问题标题】:How to use fontawesome light icons in my react-native application?如何在我的 react-native 应用程序中使用 fontawesome 灯光图标?
【发布时间】:2019-06-09 12:11:36
【问题描述】:

我尝试在我的 react-native 应用程序中使用 Font Awesome Pro 灯图标。

我导入了我需要的包并将库添加到我想要使用的图标中。

import { library } from '@fortawesome/fontawesome-svg-core';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import {faIgloo} from '@fortawesome/fontawesome-pro';
...
//App.js
class App extends React.Component {
  render() {
    library.add(faIgloo);
    return (
      <View style={styles.container}>
      <MainNavigator />
    </View>
    );
  }
}


//Slides.js where I want to show icon.
...
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
...
  renderSlides(){
        return(
            <View>
              <FontAwesomeIcon icon="fa-igloo" />
            </View>);
        });
}

但问题是,图标的前缀是“fas”,意思是'solid'。如何将其更改为'light'

【问题讨论】:

标签: react-native font-awesome


【解决方案1】:
import FontAwesome5Pro from 'react-native-vector-icons/FontAwesome5Pro';
   
const icon = <FontAwesome5Pro name={'comments'} light />;

【讨论】:

  • 'light' 在当前的react-native-vector-icons 实现中不是一个选项
猜你喜欢
  • 2023-02-23
  • 2021-05-08
  • 2022-10-07
  • 1970-01-01
  • 2021-07-21
  • 2019-08-15
  • 1970-01-01
  • 2021-02-08
  • 1970-01-01
相关资源
最近更新 更多