react-native-material-design
Version:
React Native Material Design Components
37 lines (31 loc) • 956 B
JavaScript
import React, {Component, PropTypes} from "react";
import {View} from "react-native";
import { getColor } from './helpers';
import VectorIconComponent from './VectorIconComponent';
export default class Icon extends Component {
static propTypes = {
name: PropTypes.string.isRequired,
style: View.propTypes.style,
size: PropTypes.number,
color: PropTypes.string,
allowFontScaling: PropTypes.bool
};
static defaultProps = {
size: 30,
color: '#757575',
allowFontScaling: true
};
render() {
const { name, style, size, color, allowFontScaling} = this.props;
const VectorIcon = VectorIconComponent.get();
return (
<VectorIcon
name={name}
size={size}
color={getColor(color)}
style={style}
allowFontScaling={allowFontScaling}
/>
);
}
}