Skip to content

Instantly share code, notes, and snippets.

View EmaSuriano's full-sized avatar
🇦🇷

Ema Suriano EmaSuriano

🇦🇷
View GitHub Profile
@EmaSuriano
EmaSuriano / Icon.native.js
Created June 3, 2019 09:04
Icon component that uses react-native-vector-icons to load a custom font along with the glyph map
import customFontGlyph from '../../assets/font/custom-font-icon.json';
import { createIconSet } from 'react-native-vector-icons';
export default createIconSet(customFontGlyph, 'custom-font-icon', 'custom-font-icon.ttf');
@EmaSuriano
EmaSuriano / index.js
Created June 3, 2019 08:29
Example of generated index file by create-icon.js
import React from 'react';
import Icon from './Icon';
export const Louvre = props => <Icon {...props} name="001-louvre" />;
export const LeaningTowerOfPisa = props => <Icon {...props} name="002-leaning tower of pisa" />;
export const Coliseum = props => <Icon {...props} name="003-coliseum" />;
export const Stonehenge = props => <Icon {...props} name="004-stonehenge" />;
// and the list continue ...
@EmaSuriano
EmaSuriano / create-icon.js
Created June 3, 2019 07:42
Generate RN icons based on SVG
const { execSync } = require('child_process');
const fs = require('fs');
const toPascalCase = string =>
string
.match(/[a-z]+/gi)
.map(word => word.charAt(0).toUpperCase() + word.substr(1).toLowerCase())
.join('');
console.log('Ready to generate RN icon font ⏰');
// App.js
import React from 'react';
import { ThemeProvider } from 'styled-components';
import MyApp from 'src/MyApp';
const theme = {
button: {
color: 'white',
background: 'coral',