mirror of
https://github.com/fergalmoran/argon-react-native.git
synced 2025-12-26 19:27:56 +00:00
first init
This commit is contained in:
34
components/Icon.js
Normal file
34
components/Icon.js
Normal file
@@ -0,0 +1,34 @@
|
||||
import React from 'react';
|
||||
import { Font } from 'expo';
|
||||
import { createIconSetFromIcoMoon } from '@expo/vector-icons';
|
||||
import { Icon } from 'galio-framework';
|
||||
|
||||
import argonConfig from '../assets/font/argon.json';
|
||||
const ArgonExtra = require('../assets/font/argon.ttf');
|
||||
const IconArgonExtra = createIconSetFromIcoMoon(argonConfig, 'ArgonExtra');
|
||||
|
||||
class IconExtra extends React.Component {
|
||||
state = {
|
||||
fontLoaded: false,
|
||||
}
|
||||
|
||||
async componentDidMount() {
|
||||
await Font.loadAsync({ ArgonExtra: ArgonExtra });
|
||||
this.setState({ fontLoaded: true });
|
||||
}
|
||||
|
||||
render() {
|
||||
const { name, family, ...rest } = this.props;
|
||||
|
||||
if (name && family && this.state.fontLoaded) {
|
||||
if (family === 'ArgonExtra') {
|
||||
return <IconArgonExtra name={name} family={family} {...rest} />;
|
||||
}
|
||||
return <Icon name={name} family={family} {...rest} />;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
export default IconExtra;
|
||||
Reference in New Issue
Block a user