Skip to content

Commit

Permalink
Use fontReference instead of fontFamily for web (#778)
Browse files Browse the repository at this point in the history
* Fix for Webpack keeping fontFamily parameter for iOS

* Update create-icon-set.js

* Update create-icon-set.js

* Update create-icon-set.js

* Remove whitespace

* Fix iOS

* Fix prettier

* Fix prettier
  • Loading branch information
yairopro authored and oblador committed Jul 28, 2018
1 parent 4aa125f commit f34d291
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions lib/create-icon-set.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,17 @@ export default function createIconSet(
fontFile,
fontStyle
) {
let fontReference = fontFamily;
// Android doesn't care about actual fontFamily name, it will only look in fonts folder.
if (Platform.OS === 'android' && fontFile) {
fontReference = fontFile.replace(/\.(otf|ttf)$/, '');
}

if (Platform.OS === 'windows' && fontFile) {
fontReference = `Assets/${fontFile}#${fontFamily}`;
}
const fontBasename = fontFile
? fontFile.replace(/\.(otf|ttf)$/, '')
: fontFamily;

const fontReference = Platform.select({
windows: `Assets/${fontFile}#${fontFamily}`,
android: fontBasename,
web: fontBasename,
default: fontFamily,
});

const IconNamePropType = PropTypes.oneOf(Object.keys(glyphMap));

Expand Down

0 comments on commit f34d291

Please sign in to comment.