[英]How to use fontawesome light icons in my react-native application?
I try to use Font Awesome Pro light icons in my react-native application.我尝试在我的 react-native 应用程序中使用 Font Awesome Pro 灯光图标。
I imported my necessary packages and add in library to my icon which I want to use.我导入了必要的包并将库添加到我想要使用的图标中。
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>);
});
}
But the problem is, the prefix of icon is "fas" which means 'solid' .How can I change this to 'light' ?但问题是,图标的前缀是“fas”,意思是“solid”。如何将其更改为“light” ?
import FontAwesome5Pro from 'react-native-vector-icons/FontAwesome5Pro';
const icon = <FontAwesome5Pro name={'comments'} light />;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.