React-native-vector-icons: Can't not use custom vector icon with IcoMoon

Created on 26 Nov 2016  路  7Comments  路  Source: oblador/react-native-vector-icons

Hi, I'm making my custom vector icon using IcoMoon website.
After download the zip file from IcoMoon, i got a selection.json and i put it in my react native project.
My code something like this:

myfont.js

import { createIconSetFromIcoMoon } from 'react-native-vector-icons';
import config from './selection.json';
export default createIconSetFromIcoMoon(config, 'myfont', 'myfont.ttf');

myfile.js

import {Actions, ActionConst} from 'react-native-router-flux';
import React, { Component } from 'react';
import {StyleSheet} from 'react-native';
import {Footer, FooterTab, Button} from 'native-base';

import myfont from './myfont';

module.exports = React.createClass({
     render() {
         return(
                <FooterTab theme={theme}>
                     <Button >
                         My Text
                         <myfont name="ico_myfont" />
                     </Button>
                 </FooterTab>
         )
     }
})

In xCode, i'm also put myfont.ttf in to Resource folder.

But when run, React Native has an warning like this, and my icon didn't show.

YellowBox.js:69 Possible Unhandled Promise Rejection (id: 0):
Cannot read property 'name' of undefined
TypeError: Cannot read property 'name' of undefined
    at http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:98469:32
    at Array.map (native)
    at Footer.renderFooter (http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:98402:16)
    at Footer.render (http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:98482:6)
    at http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:18771:13
    at measureLifeCyclePerf (http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:18052:8)
    at ReactCompositeComponentWrapper._renderValidatedComponentWithoutOwnerOrContext (http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:18770:19)
    at ReactCompositeComponentWrapper._renderValidatedComponent (http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:18797:24)
    at ReactCompositeComponentWrapper.performInitialMount (http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:18339:22)
    at ReactCompositeComponentWrapper.mountComponent (http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:18235:13)

Any idea, please?

Thank you.

Most helpful comment

Same problem here:

import {createIconSetFromIcoMoon} from 'react-native-vector-icons';
import icoMoonConfig from '../../utils/selection.json';
export default createIconSetFromIcoMoon (icoMoonConfig);

and can not find my icon

captura de pantalla 2018-04-12 a la s 2 10 15 p m

I import it like that
import CustomIcon from "../../commons/customIcon/CustomIcon.js";

All 7 comments

Looks like an error coming from the native-base Footer component. Try posting the issue there 馃憤

@dieunt Did u solved that issue, I have a same problem???

@iiitmahesh yes, i just add id for each ListItem.
<View id={thumb}></View>

I've a similar problem, but the error message is Cannot read property 'name' of undefined.

Same problem here:

import {createIconSetFromIcoMoon} from 'react-native-vector-icons';
import icoMoonConfig from '../../utils/selection.json';
export default createIconSetFromIcoMoon (icoMoonConfig);

and can not find my icon

captura de pantalla 2018-04-12 a la s 2 10 15 p m

I import it like that
import CustomIcon from "../../commons/customIcon/CustomIcon.js";

Icomoon generated json is not adding the properties object on each icon anymore...

@EdwinJDiaz I know this was a long time ago, but did you solve this issue?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jakewtaylor picture jakewtaylor  路  4Comments

AbhayVarshney picture AbhayVarshney  路  3Comments

toddmetheny picture toddmetheny  路  4Comments

lossen picture lossen  路  4Comments

alihesari picture alihesari  路  3Comments