lelandrichardson / react-primitives

Primitive React Interfaces Across Targets
MIT License
3.09k stars 108 forks source link

Add Icon as a primitive? #77

Open ekryski opened 7 years ago

ekryski commented 7 years ago

Another primitive I see missing is Icon. Icons might be able to be shoehorned into Text or Image primitives however I think that would just muddy them both up.

This one might actually be a bit tricky due to the need to include external fonts. Specifically on React Native requiring a native module when using react-native-vector-icons.

Curious to hear your thoughts on this one @lelandrichardson.

jjant commented 7 years ago

I'm curious on why wouldn't you just implement it using the Image primitive.

ekryski commented 7 years ago

Fair point, if your icon actually is an image. However, icons as fonts are much easier to style and scale and are smaller in size.

I guess, technically you could use the Text primitive as well if it is a font. The trick though is how things are loaded on different platforms, specifically when using fonts.

ktj commented 7 years ago

I think using https://github.com/chengyin/react-primitives-svg could solve your problem.