diff --git a/build/FontAwesome5.js b/build/FontAwesome5.js
index 47063b8..d055c8f 100644
--- a/build/FontAwesome5.js
+++ b/build/FontAwesome5.js
@@ -1,7 +1,13 @@
-import { createFA5iconSet } from './vendor/react-native-vector-icons/lib/create-icon-set-from-fontawesome5';
-import glyphMap from './glyphmaps/FontAwesome5Free.json';
-import metadata from './glyphmaps/FontAwesome5Free_meta.json';
+import { createFA5iconSet } from './createIconSetFromFontAwesome5';
+import glyphMap from './vendor/react-native-vector-icons/glyphmaps/FontAwesome5Free.json';
+import metadata from './vendor/react-native-vector-icons/glyphmaps/FontAwesome5Free_meta.json';
+const fontMap = {
+ Regular: require('./vendor/react-native-vector-icons/Fonts/FontAwesome5_Regular.ttf'),
+ Light: require('./vendor/react-native-vector-icons/Fonts/FontAwesome5_Regular.ttf'),
+ Solid: require('./vendor/react-native-vector-icons/Fonts/FontAwesome5_Solid.ttf'),
+ Brand: require('./vendor/react-native-vector-icons/Fonts/FontAwesome5_Brands.ttf'),
+};
export { FA5Style } from './vendor/react-native-vector-icons/lib/create-icon-set-from-fontawesome5';
-const iconSet = createFA5iconSet(glyphMap, metadata, false);
+const iconSet = createFA5iconSet(glyphMap, metadata, fontMap, false);
export default iconSet;
//# sourceMappingURL=FontAwesome5.js.map
\ No newline at end of file
diff --git a/build/FontAwesome5.js.map b/build/FontAwesome5.js.map
index efe1d08..7d39de5 100644
--- a/build/FontAwesome5.js.map
+++ b/build/FontAwesome5.js.map
@@ -1 +1 @@
-{"version":3,"file":"FontAwesome5.js","sourceRoot":"","sources":["../src/FontAwesome5.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,0EAA0E,CAAC;AAE5G,OAAO,QAAQ,MAAM,mCAAmC,CAAC;AACzD,OAAO,QAAQ,MAAM,wCAAwC,CAAC;AAE9D,OAAO,EAAE,QAAQ,EAAE,MAAM,0EAA0E,CAAC;AAEpG,MAAM,OAAO,GAAG,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;AAE5D,eAAe,OAAO,CAAC","sourcesContent":["import { createFA5iconSet } from './vendor/react-native-vector-icons/lib/create-icon-set-from-fontawesome5';\n\nimport glyphMap from './glyphmaps/FontAwesome5Free.json';\nimport metadata from './glyphmaps/FontAwesome5Free_meta.json';\n\nexport { FA5Style } from './vendor/react-native-vector-icons/lib/create-icon-set-from-fontawesome5';\n\nconst iconSet = createFA5iconSet(glyphMap, metadata, false);\n\nexport default iconSet;\n"]}
\ No newline at end of file
+{"version":3,"file":"FontAwesome5.js","sourceRoot":"","sources":["../src/FontAwesome5.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAEnE,OAAO,QAAQ,MAAM,oEAAoE,CAAC;AAC1F,OAAO,QAAQ,MAAM,yEAAyE,CAAC;AAC/F,MAAM,OAAO,GAAG;IACd,OAAO,EAAE,OAAO,CAAC,mEAAmE,CAAC;IACrF,KAAK,EAAE,OAAO,CAAC,mEAAmE,CAAC;IACnF,KAAK,EAAE,OAAO,CAAC,iEAAiE,CAAC;IACjF,KAAK,EAAE,OAAO,CAAC,kEAAkE,CAAC;CACnF,CAAC;AAEF,OAAO,EAAE,QAAQ,EAAE,MAAM,0EAA0E,CAAC;AAEpG,MAAM,OAAO,GAAG,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;AAErE,eAAe,OAAO,CAAC","sourcesContent":["import { createFA5iconSet } from './createIconSetFromFontAwesome5';\n\nimport glyphMap from './vendor/react-native-vector-icons/glyphmaps/FontAwesome5Free.json';\nimport metadata from './vendor/react-native-vector-icons/glyphmaps/FontAwesome5Free_meta.json';\nconst fontMap = {\n Regular: require('./vendor/react-native-vector-icons/Fonts/FontAwesome5_Regular.ttf'),\n Light: require('./vendor/react-native-vector-icons/Fonts/FontAwesome5_Regular.ttf'),\n Solid: require('./vendor/react-native-vector-icons/Fonts/FontAwesome5_Solid.ttf'),\n Brand: require('./vendor/react-native-vector-icons/Fonts/FontAwesome5_Brands.ttf'),\n};\n\nexport { FA5Style } from './vendor/react-native-vector-icons/lib/create-icon-set-from-fontawesome5';\n\nconst iconSet = createFA5iconSet(glyphMap, metadata, fontMap, false);\n\nexport default iconSet;\n"]}
\ No newline at end of file
diff --git a/build/Icons.d.ts b/build/Icons.d.ts
index 53f424b..69c2f37 100644
--- a/build/Icons.d.ts
+++ b/build/Icons.d.ts
@@ -3,6 +3,7 @@ export { default as Entypo } from './Entypo';
export { default as EvilIcons } from './EvilIcons';
export { default as Feather } from './Feather';
export { default as FontAwesome } from './FontAwesome';
+export { default as FontAwesome5 } from './FontAwesome5';
export { default as Foundation } from './Foundation';
export { default as Ionicons } from './Ionicons';
export { default as MaterialCommunityIcons } from './MaterialCommunityIcons';
diff --git a/build/Icons.js b/build/Icons.js
index 5f5834d..f8aca66 100644
--- a/build/Icons.js
+++ b/build/Icons.js
@@ -3,6 +3,7 @@ export { default as Entypo } from './Entypo';
export { default as EvilIcons } from './EvilIcons';
export { default as Feather } from './Feather';
export { default as FontAwesome } from './FontAwesome';
+export { default as FontAwesome5 } from './FontAwesome5';
export { default as Foundation } from './Foundation';
export { default as Ionicons } from './Ionicons';
export { default as MaterialCommunityIcons } from './MaterialCommunityIcons';
diff --git a/build/Icons.js.map b/build/Icons.js.map
index 5895160..5d75f10 100644
--- a/build/Icons.js.map
+++ b/build/Icons.js.map
@@ -1 +1 @@
-{"version":3,"file":"Icons.js","sourceRoot":"","sources":["../src/Icons.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAC7E,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,OAAO,IAAI,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAC/E,OAAO,EACL,OAAO,IAAI,yBAAyB,GACrC,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,OAAO,IAAI,wBAAwB,GACpC,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,4BAA4B,CAAC","sourcesContent":["export { default as AntDesign } from './AntDesign';\nexport { default as Entypo } from './Entypo';\nexport { default as EvilIcons } from './EvilIcons';\nexport { default as Feather } from './Feather';\nexport { default as FontAwesome } from './FontAwesome';\nexport { default as Foundation } from './Foundation';\nexport { default as Ionicons } from './Ionicons';\nexport { default as MaterialCommunityIcons } from './MaterialCommunityIcons';\nexport { default as MaterialIcons } from './MaterialIcons';\nexport { default as Octicons } from './Octicons';\nexport { default as SimpleLineIcons } from './SimpleLineIcons';\nexport { default as Zocial } from './Zocial';\nexport { default as createMultiStyleIconSet } from './createMultiStyleIconSet';\nexport {\n default as createIconSetFromFontello,\n} from './createIconSetFromFontello';\nexport {\n default as createIconSetFromIcoMoon,\n} from './createIconSetFromIcoMoon';\nexport { default as createMu } from './createIconSetFromIcoMoon';\n"]}
\ No newline at end of file
+{"version":3,"file":"Icons.js","sourceRoot":"","sources":["../src/Icons.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAC7E,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,OAAO,IAAI,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAC/E,OAAO,EACL,OAAO,IAAI,yBAAyB,GACrC,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,OAAO,IAAI,wBAAwB,GACpC,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,4BAA4B,CAAC","sourcesContent":["export { default as AntDesign } from './AntDesign';\nexport { default as Entypo } from './Entypo';\nexport { default as EvilIcons } from './EvilIcons';\nexport { default as Feather } from './Feather';\nexport { default as FontAwesome } from './FontAwesome';\nexport { default as FontAwesome5 } from './FontAwesome5';\nexport { default as Foundation } from './Foundation';\nexport { default as Ionicons } from './Ionicons';\nexport { default as MaterialCommunityIcons } from './MaterialCommunityIcons';\nexport { default as MaterialIcons } from './MaterialIcons';\nexport { default as Octicons } from './Octicons';\nexport { default as SimpleLineIcons } from './SimpleLineIcons';\nexport { default as Zocial } from './Zocial';\nexport { default as createMultiStyleIconSet } from './createMultiStyleIconSet';\nexport {\n default as createIconSetFromFontello,\n} from './createIconSetFromFontello';\nexport {\n default as createIconSetFromIcoMoon,\n} from './createIconSetFromIcoMoon';\nexport { default as createMu } from './createIconSetFromIcoMoon';\n"]}
\ No newline at end of file
diff --git a/build/IconsLazy.js b/build/IconsLazy.js
index ef994ee..f6f8d11 100644
--- a/build/IconsLazy.js
+++ b/build/IconsLazy.js
@@ -33,6 +33,12 @@ Object.defineProperty(exports, "FontAwesome", {
return _FontAwesome.default;
}
});
+Object.defineProperty(exports, "FontAwesome5", {
+ enumerable: true,
+ get: function () {
+ return _FontAwesome2.default;
+ }
+});
Object.defineProperty(exports, "Foundation", {
enumerable: true,
get: function () {
@@ -110,6 +116,8 @@ var _Feather = _interopRequireDefault(require("./Feather"));
var _FontAwesome = _interopRequireDefault(require("./FontAwesome"));
+var _FontAwesome2 = _interopRequireDefault(require("./FontAwesome5"));
+
var _Foundation = _interopRequireDefault(require("./Foundation"));
var _Ionicons = _interopRequireDefault(require("./Ionicons"));
diff --git a/build/IconsLazy.js.map b/build/IconsLazy.js.map
index d5621fc..ee3950d 100644
--- a/build/IconsLazy.js.map
+++ b/build/IconsLazy.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/Icons.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAGA","file":"IconsLazy.js","sourcesContent":["export { default as AntDesign } from './AntDesign';\nexport { default as Entypo } from './Entypo';\nexport { default as EvilIcons } from './EvilIcons';\nexport { default as Feather } from './Feather';\nexport { default as FontAwesome } from './FontAwesome';\nexport { default as Foundation } from './Foundation';\nexport { default as Ionicons } from './Ionicons';\nexport { default as MaterialCommunityIcons } from './MaterialCommunityIcons';\nexport { default as MaterialIcons } from './MaterialIcons';\nexport { default as Octicons } from './Octicons';\nexport { default as SimpleLineIcons } from './SimpleLineIcons';\nexport { default as Zocial } from './Zocial';\nexport { default as createMultiStyleIconSet } from './createMultiStyleIconSet';\nexport {\n default as createIconSetFromFontello,\n} from './createIconSetFromFontello';\nexport {\n default as createIconSetFromIcoMoon,\n} from './createIconSetFromIcoMoon';\nexport { default as createMu } from './createIconSetFromIcoMoon';\n"]}
\ No newline at end of file
+{"version":3,"sources":["../src/Icons.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAGA","file":"IconsLazy.js","sourcesContent":["export { default as AntDesign } from './AntDesign';\nexport { default as Entypo } from './Entypo';\nexport { default as EvilIcons } from './EvilIcons';\nexport { default as Feather } from './Feather';\nexport { default as FontAwesome } from './FontAwesome';\nexport { default as FontAwesome5 } from './FontAwesome5';\nexport { default as Foundation } from './Foundation';\nexport { default as Ionicons } from './Ionicons';\nexport { default as MaterialCommunityIcons } from './MaterialCommunityIcons';\nexport { default as MaterialIcons } from './MaterialIcons';\nexport { default as Octicons } from './Octicons';\nexport { default as SimpleLineIcons } from './SimpleLineIcons';\nexport { default as Zocial } from './Zocial';\nexport { default as createMultiStyleIconSet } from './createMultiStyleIconSet';\nexport {\n default as createIconSetFromFontello,\n} from './createIconSetFromFontello';\nexport {\n default as createIconSetFromIcoMoon,\n} from './createIconSetFromIcoMoon';\nexport { default as createMu } from './createIconSetFromIcoMoon';\n"]}
\ No newline at end of file
diff --git a/build/createIconSet.d.ts b/build/createIconSet.d.ts
index 435f776..3af473b 100644
--- a/build/createIconSet.d.ts
+++ b/build/createIconSet.d.ts
@@ -1,5 +1,6 @@
import React from 'react';
-export default function (glyphMap: any, fontName: any, expoAssetId: any): {
+export { DEFAULT_ICON_COLOR, DEFAULT_ICON_SIZE } from './vendor/react-native-vector-icons/lib/create-icon-set';
+export default function (glyphMap: any, fontName: any, expoAssetId: any, fontStyle?: any): {
new (props: Readonly<{}>): {
_mounted: boolean;
_icon?: any;
diff --git a/build/createIconSet.js b/build/createIconSet.js
index ec8ea13..b303334 100644
--- a/build/createIconSet.js
+++ b/build/createIconSet.js
@@ -3,10 +3,11 @@ import { Text } from 'react-native';
import * as Font from 'expo-font';
import createIconSet from './vendor/react-native-vector-icons/lib/create-icon-set';
import createIconButtonComponent from './vendor/react-native-vector-icons/lib/icon-button';
-export default function (glyphMap, fontName, expoAssetId) {
+export { DEFAULT_ICON_COLOR, DEFAULT_ICON_SIZE } from './vendor/react-native-vector-icons/lib/create-icon-set';
+export default function (glyphMap, fontName, expoAssetId, fontStyle) {
var _a;
const font = { [fontName]: expoAssetId };
- const RNVIconComponent = createIconSet(glyphMap, fontName);
+ const RNVIconComponent = createIconSet(glyphMap, fontName, null, fontStyle);
return _a = class Icon extends React.Component {
constructor() {
super(...arguments);
diff --git a/build/createIconSet.js.map b/build/createIconSet.js.map
index 66cb2f0..ac98659 100644
--- a/build/createIconSet.js.map
+++ b/build/createIconSet.js.map
@@ -1 +1 @@
-{"version":3,"file":"createIconSet.js","sourceRoot":"","sources":["../src/createIconSet.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,C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,CAAC,gBAAgB,CACf,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE;oBACV,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;gBACpB,CAAC,CAAC,CACF,IAAI,IAAI,CAAC,KAAK,CAAC,EACf,CACH,CAAC;YACJ,CAAC;SACF;QAhDQ,YAAS,GAAG,gBAAgB,CAAC,SAAU;QACvC,eAAY,GAAG,gBAAgB,CAAC,YAAa;QAC7C,SAAM,GAAG,yBAAyB,CAAC,EAAI,CAAE;QACzC,WAAQ,GAAG,QAAS;QACpB,iBAAc,GAAG,GAAG,EAAE,CAAC,QAAS;QAChC,gBAAa,GAAG,GAAG,EAAE,CAAC,QAAS;QAC/B,WAAQ,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAE;QACtC,OAAI,GAAG,IAAK;WAyCnB;AACJ,CAAC","sourcesContent":["import React from 'react';\nimport { Text } from 'react-native';\nimport * as Font from 'expo-font';\nimport createIconSet from './vendor/react-native-vector-icons/lib/create-icon-set';\nimport createIconButtonComponent from './vendor/react-native-vector-icons/lib/icon-button';\n\nexport default function(glyphMap, fontName, expoAssetId) {\n const font = { [fontName]: expoAssetId };\n const RNVIconComponent = createIconSet(glyphMap, fontName);\n\n return class Icon extends React.Component {\n static propTypes = RNVIconComponent.propTypes;\n static defaultProps = RNVIconComponent.defaultProps;\n static Button = createIconButtonComponent(Icon);\n static glyphMap = glyphMap;\n static getRawGlyphMap = () => glyphMap;\n static getFontFamily = () => fontName;\n static loadFont = () => Font.loadAsync(font);\n static font = font;\n\n _mounted = false;\n _icon?: any;\n\n state = {\n fontIsLoaded: Font.isLoaded(fontName),\n };\n\n async componentWillMount() {\n this._mounted = true;\n if (!this.state.fontIsLoaded) {\n await Font.loadAsync(font);\n this._mounted && this.setState({ fontIsLoaded: true });\n }\n }\n\n componentWillUnmount() {\n this._mounted = false;\n }\n\n setNativeProps(props) {\n if (this._icon) {\n this._icon.setNativeProps(props);\n }\n }\n\n render() {\n if (!this.state.fontIsLoaded) {\n return ;\n }\n\n return (\n {\n this._icon = view;\n }}\n {...this.props}\n />\n );\n }\n };\n}\n"]}
\ No newline at end of file
+{"version":3,"file":"createIconSet.js","sourceRoot":"","sources":["../src/createIconSet.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACpC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,aAAa,MAAM,wDAAwD,CAAC;AACnF,OAAO,yBAAyB,MAAM,oDAAoD,CAAC;AAE3F,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,wDAAwD,CAAC;AAE/G,MAAM,CAAC,OAAO,WAAU,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAe;;IACtE,MAAM,IAAI,GAAG,EAAE,CAAC,QAAQ,CAAC,EAAE,WAAW,EAAE,CAAC;IACzC,MAAM,gBAAgB,GAAG,aAAa,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;IAE5E,YAAO,MAAM,IAAK,SAAQ,KAAK,CAAC,SAAS;YAAlC;;gBAUL,aAAQ,GAAG,KAAK,CAAC;gBAGjB,UAAK,GAAG;oBACN,YAAY,EAAE,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC;iBACtC,CAAC;YAkCJ,CAAC;YAhCC,KAAK,CAAC,kBAAkB;gBACtB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;gBACrB,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE;oBAC5B,MAAM,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;oBAC3B,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ,CAAC,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC;iBACxD;YACH,CAAC;YAED,oBAAoB;gBAClB,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;YACxB,CAAC;YAED,cAAc,CAAC,KAAK;gBAClB,IAAI,IAAI,CAAC,KAAK,EAAE;oBACd,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;iBAClC;YACH,CAAC;YAED,MAAM;gBACJ,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE;oBAC5B,OAAO,CAAC,IAAI,CAAC,AAAD,EAAG,CAAC;iBACjB;gBAED,OAAO,CACL,CAAC,gBAAgB,CACf,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE;oBACV,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;gBACpB,CAAC,CAAC,CACF,IAAI,IAAI,CAAC,KAAK,CAAC,EACf,CACH,CAAC;YACJ,CAAC;SACF;QAhDQ,YAAS,GAAG,gBAAgB,CAAC,SAAU;QACvC,eAAY,GAAG,gBAAgB,CAAC,YAAa;QAC7C,SAAM,GAAG,yBAAyB,CAAC,EAAI,CAAE;QACzC,WAAQ,GAAG,QAAS;QACpB,iBAAc,GAAG,GAAG,EAAE,CAAC,QAAS;QAChC,gBAAa,GAAG,GAAG,EAAE,CAAC,QAAS;QAC/B,WAAQ,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAE;QACtC,OAAI,GAAG,IAAK;WAyCnB;AACJ,CAAC","sourcesContent":["import React from 'react';\nimport { Text } from 'react-native';\nimport * as Font from 'expo-font';\nimport createIconSet from './vendor/react-native-vector-icons/lib/create-icon-set';\nimport createIconButtonComponent from './vendor/react-native-vector-icons/lib/icon-button';\n\nexport { DEFAULT_ICON_COLOR, DEFAULT_ICON_SIZE } from './vendor/react-native-vector-icons/lib/create-icon-set';\n\nexport default function(glyphMap, fontName, expoAssetId, fontStyle?: any) {\n const font = { [fontName]: expoAssetId };\n const RNVIconComponent = createIconSet(glyphMap, fontName, null, fontStyle);\n\n return class Icon extends React.Component {\n static propTypes = RNVIconComponent.propTypes;\n static defaultProps = RNVIconComponent.defaultProps;\n static Button = createIconButtonComponent(Icon);\n static glyphMap = glyphMap;\n static getRawGlyphMap = () => glyphMap;\n static getFontFamily = () => fontName;\n static loadFont = () => Font.loadAsync(font);\n static font = font;\n\n _mounted = false;\n _icon?: any;\n\n state = {\n fontIsLoaded: Font.isLoaded(fontName),\n };\n\n async componentWillMount() {\n this._mounted = true;\n if (!this.state.fontIsLoaded) {\n await Font.loadAsync(font);\n this._mounted && this.setState({ fontIsLoaded: true });\n }\n }\n\n componentWillUnmount() {\n this._mounted = false;\n }\n\n setNativeProps(props) {\n if (this._icon) {\n this._icon.setNativeProps(props);\n }\n }\n\n render() {\n if (!this.state.fontIsLoaded) {\n return ;\n }\n\n return (\n {\n this._icon = view;\n }}\n {...this.props}\n />\n );\n }\n };\n}\n"]}
\ No newline at end of file
diff --git a/build/createIconSetFromFontAwesome5.d.ts b/build/createIconSetFromFontAwesome5.d.ts
new file mode 100644
index 0000000..b774728
--- /dev/null
+++ b/build/createIconSetFromFontAwesome5.d.ts
@@ -0,0 +1,7 @@
+export declare const FA5Style: {
+ regular: string;
+ light: string;
+ solid: string;
+ brand: string;
+};
+export declare function createFA5iconSet(glyphMap: any, metadata: {} | undefined, fonts: any, pro?: boolean): any;
diff --git a/build/createIconSetFromFontAwesome5.js b/build/createIconSetFromFontAwesome5.js
new file mode 100644
index 0000000..e15c1a6
--- /dev/null
+++ b/build/createIconSetFromFontAwesome5.js
@@ -0,0 +1,53 @@
+import createMultiStyleIconSet from './createMultiStyleIconSet';
+export const FA5Style = {
+ regular: 'regular',
+ light: 'light',
+ solid: 'solid',
+ brand: 'brand',
+};
+export function createFA5iconSet(glyphMap, metadata = {}, fonts, pro = false) {
+ const metadataKeys = Object.keys(metadata);
+ const fontFamily = `FontAwesome5${pro ? 'Pro' : 'Free'}`;
+ function fallbackFamily(glyph) {
+ for (let i = 0; i < metadataKeys.length; i += 1) {
+ const family = metadataKeys[i];
+ if (metadata[family].indexOf(glyph) !== -1) {
+ return family === 'brands' ? 'brand' : family;
+ }
+ }
+ return 'regular';
+ }
+ function glyphValidator(glyph, style) {
+ const family = style === 'brand' ? 'brands' : style;
+ if (metadataKeys.indexOf(family) === -1)
+ return false;
+ return metadata[family].indexOf(glyph) !== -1;
+ }
+ function createFontAwesomeStyle(styleName, fontWeight, family = fontFamily) {
+ let fontFile = fonts[styleName];
+ return {
+ fontFamily: `${family}-${styleName}`,
+ fontFile,
+ fontStyle: {
+ fontWeight,
+ },
+ glyphMap,
+ };
+ }
+ const brandIcons = createFontAwesomeStyle('Brand', '400');
+ const lightIcons = createFontAwesomeStyle('Light', '100');
+ const regularIcons = createFontAwesomeStyle('Regular', '400');
+ const solidIcons = createFontAwesomeStyle('Solid', '700');
+ const Icon = createMultiStyleIconSet({
+ brand: brandIcons,
+ light: lightIcons,
+ regular: regularIcons,
+ solid: solidIcons,
+ }, {
+ defaultStyle: 'regular',
+ fallbackFamily,
+ glyphValidator,
+ });
+ return Icon;
+}
+//# sourceMappingURL=createIconSetFromFontAwesome5.js.map
\ No newline at end of file
diff --git a/build/createIconSetFromFontAwesome5.js.map b/build/createIconSetFromFontAwesome5.js.map
new file mode 100644
index 0000000..43f219f
--- /dev/null
+++ b/build/createIconSetFromFontAwesome5.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"createIconSetFromFontAwesome5.js","sourceRoot":"","sources":["../src/createIconSetFromFontAwesome5.ts"],"names":[],"mappings":"AAAA,OAAO,uBAAuB,MAAM,2BAA2B,CAAC;AAEhE,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,OAAO;IACd,KAAK,EAAE,OAAO;IACd,KAAK,EAAE,OAAO;CACf,CAAC;AAEF,MAAM,UAAU,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,GAAG,EAAE,EAAE,KAAK,EAAE,GAAG,GAAG,KAAK;IAC1E,MAAM,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,CA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O,EAAE,KAAK,CAAC,CAAC;IAC1D,MAAM,YAAY,GAAG,sBAAsB,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;IAC9D,MAAM,UAAU,GAAG,sBAAsB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAC1D,MAAM,IAAI,GAAG,uBAAuB,CAClC;QACE,KAAK,EAAE,UAAU;QACjB,KAAK,EAAE,UAAU;QACjB,OAAO,EAAE,YAAY;QACrB,KAAK,EAAE,UAAU;KAClB,EACD;QACE,YAAY,EAAE,SAAS;QACvB,cAAc;QACd,cAAc;KACf,CACF,CAAC;IAEF,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import createMultiStyleIconSet from './createMultiStyleIconSet';\n\nexport const FA5Style = {\n regular: 'regular',\n light: 'light',\n solid: 'solid',\n brand: 'brand',\n};\n\nexport function createFA5iconSet(glyphMap, metadata = {}, fonts, pro = false) {\n const metadataKeys = Object.keys(metadata);\n const fontFamily = `FontAwesome5${pro ? 'Pro' : 'Free'}`;\n\n function fallbackFamily(glyph) {\n for (let i = 0; i < metadataKeys.length; i += 1) {\n const family = metadataKeys[i];\n if (metadata[family].indexOf(glyph) !== -1) {\n return family === 'brands' ? 'brand' : family;\n }\n }\n\n return 'regular';\n }\n\n function glyphValidator(glyph, style) {\n const family = style === 'brand' ? 'brands' : style;\n if (metadataKeys.indexOf(family) === -1) return false;\n return metadata[family].indexOf(glyph) !== -1;\n }\n\n function createFontAwesomeStyle(styleName, fontWeight, family = fontFamily) {\n let fontFile = fonts[styleName];\n\n return {\n fontFamily: `${family}-${styleName}`,\n fontFile,\n fontStyle: {\n fontWeight,\n },\n glyphMap,\n };\n }\n\n const brandIcons = createFontAwesomeStyle('Brand', '400');\n const lightIcons = createFontAwesomeStyle('Light', '100');\n const regularIcons = createFontAwesomeStyle('Regular', '400');\n const solidIcons = createFontAwesomeStyle('Solid', '700');\n const Icon = createMultiStyleIconSet(\n {\n brand: brandIcons,\n light: lightIcons,\n regular: regularIcons,\n solid: solidIcons,\n },\n {\n defaultStyle: 'regular',\n fallbackFamily,\n glyphValidator,\n },\n );\n\n return Icon;\n}"]}
\ No newline at end of file
diff --git a/build/createMultiStyleIconSet.d.ts b/build/createMultiStyleIconSet.d.ts
index 3bffb15..62485f2 100644
--- a/build/createMultiStyleIconSet.d.ts
+++ b/build/createMultiStyleIconSet.d.ts
@@ -1 +1,11 @@
-export default function (config: any, expoFontName: any, expoAssetId: any): any;
+declare type FontStyle = {
+ fontFamily: string;
+ fontFile: any;
+ glyphMap: any;
+ fontStyle: any;
+};
+declare type FontStyles = {
+ [key: string]: FontStyle;
+};
+export default function createMultiStyleIconSet(styles: FontStyles, optionsInput?: {}): any;
+export {};
diff --git a/build/createMultiStyleIconSet.js b/build/createMultiStyleIconSet.js
index d2d89fc..d144fab 100644
--- a/build/createMultiStyleIconSet.js
+++ b/build/createMultiStyleIconSet.js
@@ -1,5 +1,95 @@
-import createMultiStyleIconSet from './vendor/react-native-vector-icons/lib/create-multi-style-icon-set';
-export default function (config, expoFontName, expoAssetId) {
- return createMultiStyleIconSet(config, expoFontName, expoAssetId);
+import React, { PureComponent } from 'react';
+import PropTypes from 'prop-types';
+import createIconSet from './createIconSet';
+export default function createMultiStyleIconSet(styles, optionsInput = {}) {
+ const styleNames = Object.keys(styles);
+ if (styleNames.length === 0) {
+ throw new Error('You need to add at least one style');
+ }
+ const options = {
+ defaultStyle: styleNames[0],
+ fallbackFamily: (_unused) => styleNames[0],
+ glyphValidator: (_unused, __unused) => true,
+ ...optionsInput,
+ };
+ const iconSets = styleNames.reduce((acc, name) => {
+ const style = styles[name];
+ acc[name] = createIconSet(style.glyphMap || {}, style.fontFamily || '', style.fontFile || '', style.fontStyle || {});
+ return acc;
+ }, {});
+ function styleFromProps(props) {
+ return Object.keys(props).reduce((result, propName) => styleNames.indexOf(propName) !== -1 && props[propName] === true
+ ? propName
+ : result, options.defaultStyle);
+ }
+ function getIconSetForProps(props) {
+ const { name } = props;
+ const style = styleFromProps(props);
+ if (options.glyphValidator(name, style))
+ return iconSets[style];
+ const family = options.fallbackFamily(name);
+ if (styleNames.indexOf(family) === -1) {
+ return options.defaultStyle;
+ }
+ return iconSets[family];
+ }
+ function selectIconClass(iconSet, iconClass) {
+ return iconClass.length > 0 ? iconSet[iconClass] : iconSet;
+ }
+ function reduceProps(props) {
+ return Object.keys(props).reduce((acc, prop) => {
+ if (styleNames.indexOf(prop) === -1) {
+ acc[prop] = props[prop];
+ }
+ return acc;
+ }, {});
+ }
+ function getStyledIconSet(style, name = '') {
+ if (styleNames.indexOf(style) === -1) {
+ return iconSets[options.defaultStyle];
+ }
+ return !name
+ ? iconSets[styleFromProps({ [style]: true })]
+ : getIconSetForProps({ name, [style]: true });
+ }
+ function getFontFamily(style = options.defaultStyle) {
+ return getStyledIconSet(style).getFontFamily();
+ }
+ function getRawGlyphMap(style = options.defaultStyle) {
+ return getStyledIconSet(style).getRawGlyphMap();
+ }
+ function hasIcon(name, style = options.defaultStyle) {
+ return options.glyphValidator(name, style);
+ }
+ function createStyledIconClass(selectClass = '') {
+ class IconClass extends PureComponent {
+ render() {
+ const selectedIconSet = getIconSetForProps(this.props);
+ const SelectedIconClass = selectIconClass(selectedIconSet, selectClass);
+ const props = reduceProps(this.props);
+ return React.createElement(SelectedIconClass, props);
+ }
+ }
+ IconClass.propTypes = styleNames.reduce((acc, name) => {
+ acc[name] = PropTypes.bool;
+ return acc;
+ }, {});
+ IconClass.defaultProps = styleNames.reduce((acc, name) => {
+ acc[name] = false;
+ return acc;
+ }, {});
+ IconClass.font = Object.values(styles).reduce((acc, style) => {
+ acc[style.fontFamily] = style.fontFile;
+ return acc;
+ }, {});
+ IconClass.StyledIconSet = getStyledIconSet;
+ IconClass.getFontFamily = getFontFamily;
+ IconClass.getRawGlyphMap = getRawGlyphMap;
+ IconClass.hasIcon = hasIcon;
+ return IconClass;
+ }
+ const Icon = createStyledIconClass();
+ Icon.Button = createStyledIconClass('Button');
+ return Icon;
}
//# sourceMappingURL=createMultiStyleIconSet.js.map
\ No newline at end of file
diff --git a/build/createMultiStyleIconSet.js.map b/build/createMultiStyleIconSet.js.map
index 8cce052..6e02ab5 100644
--- a/build/createMultiStyleIconSet.js.map
+++ b/build/createMultiStyleIconSet.js.map
@@ -1 +1 @@
-{"version":3,"file":"createMultiStyleIconSet.js","sourceRoot":"","sources":["../src/createMultiStyleIconSet.ts"],"names":[],"mappings":"AAAA,OAAO,uBAAuB,MAAM,oEAAoE,CAAC;AAEzG,MAAM,CAAC,OAAO,WAAU,MAAM,EAAE,YAAY,EAAE,WAAW;IACvD,OAAO,uBAAuB,CAAC,MAAM,EAAE,YAAY,EAAE,WAAW,CAAC,CAAC;AACpE,CAAC","sourcesContent":["import createMultiStyleIconSet from './vendor/react-native-vector-icons/lib/create-multi-style-icon-set';\n\nexport default function(config, expoFontName, expoAssetId) {\n return createMultiStyleIconSet(config, expoFontName, expoAssetId);\n}\n"]}
\ No newline at end of file
+{"version":3,"file":"createMultiStyleIconSet.js","sourceRoot":"","sources":["../src/createMultiStyleIconSet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC7C,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAa5C,MAAM,CAAC,OAAO,UAAU,uBAAuB,CAC7C,MAAkB,EAClB,YAAY,GAAG,EAAE;IAEjB,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAEvC,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE;QAC3B,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC;KACvD;IAED,MAAM,OAAO,GAAG;QACd,YAAY,EAAE,UAAU,CAAC,CAAC,CAAC;QAC3B,cAAc,EAAE,CAAC,OAAY,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC;QAC/C,cAAc,EAAE,CAAC,OAAY,EAA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,wBAAc,GAAG,cAAc,CAAC;QAChC,iBAAO,GAAG,OAAO,CAAC;QAW3B,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,IAAI,GAAG,qBAAqB,EAAE,CAAC;IACrC,IAAI,CAAC,MAAM,GAAG,qBAAqB,CAAC,QAAQ,CAAC,CAAC;IAC9C,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import React, { PureComponent } from 'react';\nimport PropTypes from 'prop-types';\n\nimport createIconSet from './createIconSet';\n\ntype FontStyle = {\n fontFamily: string;\n fontFile: any;\n glyphMap: any;\n fontStyle: any;\n};\n\ntype FontStyles = {\n [key: string]: FontStyle;\n};\n\nexport default function createMultiStyleIconSet(\n styles: FontStyles,\n optionsInput = {}\n): any {\n const styleNames = Object.keys(styles);\n\n if (styleNames.length === 0) {\n throw new Error('You need to add at least one style');\n }\n\n const options = {\n defaultStyle: styleNames[0],\n fallbackFamily: (_unused: any) => styleNames[0],\n glyphValidator: (_unused: any, __unused: any) => true,\n ...optionsInput,\n };\n\n const iconSets = styleNames.reduce((acc, name) => {\n const style = styles[name];\n\n acc[name] = createIconSet(\n style.glyphMap || {},\n style.fontFamily || '',\n style.fontFile || '',\n style.fontStyle || {}\n );\n\n return acc;\n }, {});\n\n function styleFromProps(props) {\n return Object.keys(props).reduce(\n (result, propName) =>\n styleNames.indexOf(propName) !== -1 && props[propName] === true\n ? propName\n : result,\n options.defaultStyle\n );\n }\n\n function getIconSetForProps(props) {\n const { name } = props;\n const style = styleFromProps(props);\n\n if (options.glyphValidator(name, style)) return iconSets[style];\n\n const family = options.fallbackFamily(name);\n\n if (styleNames.indexOf(family) === -1) {\n return options.defaultStyle;\n }\n\n return iconSets[family];\n }\n\n function selectIconClass(iconSet, iconClass) {\n return iconClass.length > 0 ? iconSet[iconClass] : iconSet;\n }\n\n function reduceProps(props) {\n return Object.keys(props).reduce((acc, prop) => {\n if (styleNames.indexOf(prop) === -1) {\n acc[prop] = props[prop];\n }\n\n return acc;\n }, {});\n }\n\n function getStyledIconSet(style, name = '') {\n if (styleNames.indexOf(style) === -1) {\n return iconSets[options.defaultStyle];\n }\n\n return !name\n ? iconSets[styleFromProps({ [style]: true })]\n : getIconSetForProps({ name, [style]: true });\n }\n\n function getFontFamily(style = options.defaultStyle) {\n return getStyledIconSet(style).getFontFamily();\n }\n\n function getRawGlyphMap(style = options.defaultStyle) {\n return getStyledIconSet(style).getRawGlyphMap();\n }\n\n function hasIcon(name, style = options.defaultStyle) {\n return options.glyphValidator(name, style);\n }\n\n function createStyledIconClass(selectClass = '') {\n class IconClass extends PureComponent {\n static propTypes = styleNames.reduce((acc, name) => {\n acc[name] = PropTypes.bool;\n return acc;\n }, {});\n\n static defaultProps = styleNames.reduce((acc, name) => {\n acc[name] = false;\n return acc;\n }, {});\n\n static font = Object.values(styles).reduce((acc, style) => {\n acc[style.fontFamily] = style.fontFile;\n return acc;\n }, {});\n\n static Button: any;\n\n static StyledIconSet = getStyledIconSet;\n static getFontFamily = getFontFamily;\n static getRawGlyphMap = getRawGlyphMap;\n static hasIcon = hasIcon;\n\n render() {\n const selectedIconSet = getIconSetForProps(this.props);\n const SelectedIconClass = selectIconClass(selectedIconSet, selectClass);\n const props = reduceProps(this.props);\n\n return React.createElement(SelectedIconClass, props);\n }\n }\n\n return IconClass;\n }\n\n const Icon = createStyledIconClass();\n Icon.Button = createStyledIconClass('Button');\n return Icon;\n}\n"]}
\ No newline at end of file
diff --git a/src/FontAwesome5.ts b/src/FontAwesome5.ts
index 6e05214..b4d6698 100644
--- a/src/FontAwesome5.ts
+++ b/src/FontAwesome5.ts
@@ -1,10 +1,16 @@
-import { createFA5iconSet } from './vendor/react-native-vector-icons/lib/create-icon-set-from-fontawesome5';
+import { createFA5iconSet } from './createIconSetFromFontAwesome5';
-import glyphMap from './glyphmaps/FontAwesome5Free.json';
-import metadata from './glyphmaps/FontAwesome5Free_meta.json';
+import glyphMap from './vendor/react-native-vector-icons/glyphmaps/FontAwesome5Free.json';
+import metadata from './vendor/react-native-vector-icons/glyphmaps/FontAwesome5Free_meta.json';
+const fontMap = {
+ Regular: require('./vendor/react-native-vector-icons/Fonts/FontAwesome5_Regular.ttf'),
+ Light: require('./vendor/react-native-vector-icons/Fonts/FontAwesome5_Regular.ttf'),
+ Solid: require('./vendor/react-native-vector-icons/Fonts/FontAwesome5_Solid.ttf'),
+ Brand: require('./vendor/react-native-vector-icons/Fonts/FontAwesome5_Brands.ttf'),
+};
export { FA5Style } from './vendor/react-native-vector-icons/lib/create-icon-set-from-fontawesome5';
-const iconSet = createFA5iconSet(glyphMap, metadata, false);
+const iconSet = createFA5iconSet(glyphMap, metadata, fontMap, false);
export default iconSet;
diff --git a/src/Icons.ts b/src/Icons.ts
index d10ab15..7c65c0b 100644
--- a/src/Icons.ts
+++ b/src/Icons.ts
@@ -3,6 +3,7 @@ export { default as Entypo } from './Entypo';
export { default as EvilIcons } from './EvilIcons';
export { default as Feather } from './Feather';
export { default as FontAwesome } from './FontAwesome';
+export { default as FontAwesome5 } from './FontAwesome5';
export { default as Foundation } from './Foundation';
export { default as Ionicons } from './Ionicons';
export { default as MaterialCommunityIcons } from './MaterialCommunityIcons';
diff --git a/src/createIconSet.tsx b/src/createIconSet.tsx
index 3ebb96c..aca1468 100644
--- a/src/createIconSet.tsx
+++ b/src/createIconSet.tsx
@@ -4,9 +4,11 @@ import * as Font from 'expo-font';
import createIconSet from './vendor/react-native-vector-icons/lib/create-icon-set';
import createIconButtonComponent from './vendor/react-native-vector-icons/lib/icon-button';
-export default function(glyphMap, fontName, expoAssetId) {
+export { DEFAULT_ICON_COLOR, DEFAULT_ICON_SIZE } from './vendor/react-native-vector-icons/lib/create-icon-set';
+
+export default function(glyphMap, fontName, expoAssetId, fontStyle?: any) {
const font = { [fontName]: expoAssetId };
- const RNVIconComponent = createIconSet(glyphMap, fontName);
+ const RNVIconComponent = createIconSet(glyphMap, fontName, null, fontStyle);
return class Icon extends React.Component {
static propTypes = RNVIconComponent.propTypes;
diff --git a/src/createIconSetFromFontAwesome5.ts b/src/createIconSetFromFontAwesome5.ts
new file mode 100644
index 0000000..4c65394
--- /dev/null
+++ b/src/createIconSetFromFontAwesome5.ts
@@ -0,0 +1,63 @@
+import createMultiStyleIconSet from './createMultiStyleIconSet';
+
+export const FA5Style = {
+ regular: 'regular',
+ light: 'light',
+ solid: 'solid',
+ brand: 'brand',
+};
+
+export function createFA5iconSet(glyphMap, metadata = {}, fonts, pro = false) {
+ const metadataKeys = Object.keys(metadata);
+ const fontFamily = `FontAwesome5${pro ? 'Pro' : 'Free'}`;
+
+ function fallbackFamily(glyph) {
+ for (let i = 0; i < metadataKeys.length; i += 1) {
+ const family = metadataKeys[i];
+ if (metadata[family].indexOf(glyph) !== -1) {
+ return family === 'brands' ? 'brand' : family;
+ }
+ }
+
+ return 'regular';
+ }
+
+ function glyphValidator(glyph, style) {
+ const family = style === 'brand' ? 'brands' : style;
+ if (metadataKeys.indexOf(family) === -1) return false;
+ return metadata[family].indexOf(glyph) !== -1;
+ }
+
+ function createFontAwesomeStyle(styleName, fontWeight, family = fontFamily) {
+ let fontFile = fonts[styleName];
+
+ return {
+ fontFamily: `${family}-${styleName}`,
+ fontFile,
+ fontStyle: {
+ fontWeight,
+ },
+ glyphMap,
+ };
+ }
+
+ const brandIcons = createFontAwesomeStyle('Brand', '400');
+ const lightIcons = createFontAwesomeStyle('Light', '100');
+ const regularIcons = createFontAwesomeStyle('Regular', '400');
+ const solidIcons = createFontAwesomeStyle('Solid', '700');
+ const Icon = createMultiStyleIconSet(
+ {
+ brand: brandIcons,
+ light: lightIcons,
+ regular: regularIcons,
+ solid: solidIcons,
+ },
+ {
+ defaultStyle: 'regular',
+ fallbackFamily,
+ glyphValidator,
+ },
+ );
+
+ return Icon;
+}
\ No newline at end of file
diff --git a/src/createMultiStyleIconSet.ts b/src/createMultiStyleIconSet.ts
index be83e72..dc866f2 100644
--- a/src/createMultiStyleIconSet.ts
+++ b/src/createMultiStyleIconSet.ts
@@ -1,5 +1,147 @@
-import createMultiStyleIconSet from './vendor/react-native-vector-icons/lib/create-multi-style-icon-set';
+import React, { PureComponent } from 'react';
+import PropTypes from 'prop-types';
-export default function(config, expoFontName, expoAssetId) {
- return createMultiStyleIconSet(config, expoFontName, expoAssetId);
+import createIconSet from './createIconSet';
+
+type FontStyle = {
+ fontFamily: string;
+ fontFile: any;
+ glyphMap: any;
+ fontStyle: any;
+};
+
+type FontStyles = {
+ [key: string]: FontStyle;
+};
+
+export default function createMultiStyleIconSet(
+ styles: FontStyles,
+ optionsInput = {}
+): any {
+ const styleNames = Object.keys(styles);
+
+ if (styleNames.length === 0) {
+ throw new Error('You need to add at least one style');
+ }
+
+ const options = {
+ defaultStyle: styleNames[0],
+ fallbackFamily: (_unused: any) => styleNames[0],
+ glyphValidator: (_unused: any, __unused: any) => true,
+ ...optionsInput,
+ };
+
+ const iconSets = styleNames.reduce((acc, name) => {
+ const style = styles[name];
+
+ acc[name] = createIconSet(
+ style.glyphMap || {},
+ style.fontFamily || '',
+ style.fontFile || '',
+ style.fontStyle || {}
+ );
+
+ return acc;
+ }, {});
+
+ function styleFromProps(props) {
+ return Object.keys(props).reduce(
+ (result, propName) =>
+ styleNames.indexOf(propName) !== -1 && props[propName] === true
+ ? propName
+ : result,
+ options.defaultStyle
+ );
+ }
+
+ function getIconSetForProps(props) {
+ const { name } = props;
+ const style = styleFromProps(props);
+
+ if (options.glyphValidator(name, style)) return iconSets[style];
+
+ const family = options.fallbackFamily(name);
+
+ if (styleNames.indexOf(family) === -1) {
+ return options.defaultStyle;
+ }
+
+ return iconSets[family];
+ }
+
+ function selectIconClass(iconSet, iconClass) {
+ return iconClass.length > 0 ? iconSet[iconClass] : iconSet;
+ }
+
+ function reduceProps(props) {
+ return Object.keys(props).reduce((acc, prop) => {
+ if (styleNames.indexOf(prop) === -1) {
+ acc[prop] = props[prop];
+ }
+
+ return acc;
+ }, {});
+ }
+
+ function getStyledIconSet(style, name = '') {
+ if (styleNames.indexOf(style) === -1) {
+ return iconSets[options.defaultStyle];
+ }
+
+ return !name
+ ? iconSets[styleFromProps({ [style]: true })]
+ : getIconSetForProps({ name, [style]: true });
+ }
+
+ function getFontFamily(style = options.defaultStyle) {
+ return getStyledIconSet(style).getFontFamily();
+ }
+
+ function getRawGlyphMap(style = options.defaultStyle) {
+ return getStyledIconSet(style).getRawGlyphMap();
+ }
+
+ function hasIcon(name, style = options.defaultStyle) {
+ return options.glyphValidator(name, style);
+ }
+
+ function createStyledIconClass(selectClass = '') {
+ class IconClass extends PureComponent {
+ static propTypes = styleNames.reduce((acc, name) => {
+ acc[name] = PropTypes.bool;
+ return acc;
+ }, {});
+
+ static defaultProps = styleNames.reduce((acc, name) => {
+ acc[name] = false;
+ return acc;
+ }, {});
+
+ static font = Object.values(styles).reduce((acc, style) => {
+ acc[style.fontFamily] = style.fontFile;
+ return acc;
+ }, {});
+
+ static Button: any;
+
+ static StyledIconSet = getStyledIconSet;
+ static getFontFamily = getFontFamily;
+ static getRawGlyphMap = getRawGlyphMap;
+ static hasIcon = hasIcon;
+
+ render() {
+ const selectedIconSet = getIconSetForProps(this.props);
+ const SelectedIconClass = selectIconClass(selectedIconSet, selectClass);
+ const props = reduceProps(this.props);
+
+ return React.createElement(SelectedIconClass, props);
+ }
+ }
+
+ return IconClass;
+ }
+
+ const Icon = createStyledIconClass();
+ Icon.Button = createStyledIconClass('Button');
+ return Icon;
}