mirror of
https://github.com/zhigang1992/react-native-vector-icons.git
synced 2026-01-12 22:51:07 +08:00
Make name prop optional. Closes #406
This commit is contained in:
@@ -33,7 +33,7 @@ export default function createIconSet(glyphMap, fontFamily, fontFile) {
|
||||
|
||||
class Icon extends Component {
|
||||
static propTypes = {
|
||||
name: IconNamePropType.isRequired,
|
||||
name: IconNamePropType,
|
||||
size: PropTypes.number,
|
||||
color: PropTypes.string,
|
||||
children: PropTypes.node,
|
||||
@@ -59,7 +59,7 @@ export default function createIconSet(glyphMap, fontFamily, fontFile) {
|
||||
render() {
|
||||
const { name, size, color, style, ...props } = this.props;
|
||||
|
||||
let glyph = glyphMap[name] || '?';
|
||||
let glyph = name ? glyphMap[name] || '?' : '';
|
||||
if (typeof glyph === 'number') {
|
||||
glyph = String.fromCharCode(glyph);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user