我尝试在我的本机应用程序中使用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'?
答案 0 :(得分:0)
import FontAwesome5Pro from 'react-native-vector-icons/FontAwesome5Pro';
const icon = <FontAwesome5Pro name={'comments'} light />;