diff --git a/Icon.js b/Icon.js index ca27e94..e00c88c 100644 --- a/Icon.js +++ b/Icon.js @@ -8,8 +8,12 @@ import { prefixTypes } from "./config"; const DEFAULT_ICON = "question-circle"; const Icon = ( { name, size, color, type, containerStyle, iconStyle, onPress, activeOpacity } ) => { - - const prefix = prefixTypes[type]; + let prefix; + if (type && prefixTypes[type]) { + prefix = prefixTypes[type]; + } else { + prefix = FontAwesomeConfig.familyPrefix || prefixTypes["regular"]; + } let icon = findIconDefinition( { prefix, iconName: name } ); if ( !icon ) { @@ -74,9 +78,7 @@ Icon.defaultProps = { name: "", size: 20, color: "black", - type: "regular", activeOpacity: 0.2, - type: "regular" }; export default Icon; diff --git a/config.js b/config.js index b88c1c6..4552b1f 100644 --- a/config.js +++ b/config.js @@ -1,4 +1,4 @@ -import { config, library } from "@fortawesome/fontawesome-svg-core"; +import { library } from "@fortawesome/fontawesome-svg-core"; import { fal } from "@fortawesome/pro-light-svg-icons"; import { far } from "@fortawesome/pro-regular-svg-icons"; import { fas } from "@fortawesome/pro-solid-svg-icons"; @@ -12,9 +12,9 @@ export const prefixTypes = { }; export const configureFontAwesomePro = ( prefixType = "regular" ) => { - FontAwesomeConfig = { - familyPrefix: prefixTypes[prefixType] - }; + if (prefixTypes[prefixType]) { + FontAwesomeConfig.familyPrefix = prefixTypes[prefixType]; + } library.add( fab, fal, far, fas ); }