lelandrichardson / react-primitives

Primitive React Interfaces Across Targets

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add Icon as a primitive?

ekryski opened this issue · comments

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.

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

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.

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