diff --git a/README.md b/README.md index 92d53887d..9d4f56869 100644 --- a/README.md +++ b/README.md @@ -217,7 +217,14 @@ Any [Text property](http://facebook.github.io/react-native/docs/text.html) and t |**`name`**|What icon to show, see Icon Explorer app or one of the links above. |*None*| |**`color`**|Color of the icon. |*Inherited*| -You can use `Icon.hasIcon(name)` to check if the name is valid in current icon set. +### Static Methods + +| Prop | Description | +|---|---| +|**`getFontFamily`**|Returns the font family that is currently used to retrieve icons as text. Usage: `const fontFamily = Icon.getFontFamily()`| +|**`getImageSource`**|Returns a promise that resolving to the source of a bitmap version of the icon for use with `Image` component et al. Usage: `const source = await Icon.getImageSource(name, size, color)`| +|**`getRawGlyphMap`**|Returns the raw glyph map of the icon set. Usage: `const glyphMap = Icon.getRawGlyphMap()` | +|**`hasIcon`**|Checks if the name is valid in current icon set. Usage: `const isNameValid = Icon.hasIcon(name)`| ### Styling Since `Icon` builds on top of the `Text` component, most [style properties](http://facebook.github.io/react-native/docs/style.html) will work as expected, you might find it useful to play around with these: diff --git a/lib/create-icon-set.js b/lib/create-icon-set.js index 019313b9b..ea8e4bc41 100644 --- a/lib/create-icon-set.js +++ b/lib/create-icon-set.js @@ -163,6 +163,14 @@ export default function createIconSet(glyphMap, fontFamily, fontFile) { return Object.prototype.hasOwnProperty.call(glyphMap, name); } + function getRawGlyphMap() { + return glyphMap; + } + + function getFontFamily() { + return fontReference; + } + Icon.Button = createIconButtonComponent(Icon); Icon.TabBarItem = createTabBarItemIOSComponent( IconNamePropType, @@ -176,6 +184,8 @@ export default function createIconSet(glyphMap, fontFamily, fontFile) { Icon.getImageSource = getImageSource; Icon.loadFont = loadFont; Icon.hasIcon = hasIcon; + Icon.getRawGlyphMap = getRawGlyphMap; + Icon.getFontFamily = getFontFamily; return Icon; }