react-native-star-rating icon indicating copy to clipboard operation
react-native-star-rating copied to clipboard

Use icon sets exported from IcoMoon

Open rodrigopk opened this issue 7 years ago • 4 comments

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 avatar Jan 05 '18 08:01 rodrigopk

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

rodrigopk avatar Jan 06 '18 12:01 rodrigopk

any updates ?

nadirHomeFriend avatar Aug 21 '18 10:08 nadirHomeFriend

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

djchie avatar Aug 28 '18 05:08 djchie

@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?

djchie avatar Aug 28 '18 05:08 djchie