Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use icon sets exported from IcoMoon #57

Open
rodrigopk opened this issue Jan 5, 2018 · 4 comments
Open

Use icon sets exported from IcoMoon #57

rodrigopk opened this issue Jan 5, 2018 · 4 comments

Comments

@rodrigopk
Copy link
Contributor

rodrigopk commented Jan 5, 2018

The react-native-vector-icons has a method createIconSetFromIcoMoon, which creates an icon sets using an IcoMoon json configuration file.
I would like to propose that the StarRating and StarButton components had an optional prop to receive a IcoMoon configuration json, so that the user is able to use his own icon set if needed.
Below follows an example to illustrate how we could use a prop for loading a custom icon set from a config json:

// star-button.js
import { createIconSetFromIcoMoon } from 'react-native-vector-icons';
.
.
.
  iconSetFromProps() {
    const {
      iconSet,
      icoMoonJson
    } = this.props;
    if (icoMoonJson) {
      return createIconSetFromIcoMoon(icoMoonJson);
    } else {
      return iconSets[iconSet];
    }
  }
@rodrigopk
Copy link
Contributor Author

I created a PR (#58) to suggest those changes

@nadirHomeFriend
Copy link

any updates ?

@djchie
Copy link
Owner

djchie commented Aug 28, 2018

I just merged this in, I'll be pushing out a new build soon. Thanks again @rodrigopk!

@djchie djchie closed this as completed Aug 28, 2018
@djchie djchie reopened this Aug 28, 2018
@djchie
Copy link
Owner

djchie commented Aug 28, 2018

@rodrigopk @nadirHomeFriend Actually this just got me thinking. I think it might be better to give more power to the developer if I moved the responsibility of setting an Icon set outside of the component? I'm thinking of just having the iconSet prop just be an Icon set. That way, people can just use createIconSet, createIconSetFromFontello, createIconSetFromIcoMoon, or the standard sets provided by react-native-vector-icons outside of the component rather than be restricted to the props within it. Thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants