简体   繁体   中英

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.

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' ?

import FontAwesome5Pro from 'react-native-vector-icons/FontAwesome5Pro';
   
const icon = <FontAwesome5Pro name={'comments'} light />;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM