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

iOS 10 to 13 fallback support #1

Open
MoOx opened this issue Jan 16, 2021 · 4 comments
Open

iOS 10 to 13 fallback support #1

MoOx opened this issue Jan 16, 2021 · 4 comments

Comments

@MoOx
Copy link
Contributor

MoOx commented Jan 16, 2021

Hi @birkir!

I am working on a react-native library to offer a consistent platform experience for icon.
This means in short: using sfsymbols on iOS when possible, and material icons for android.

I am open to help you to support iOS13- (even if I am not confortable with iOS development).
What work need to be done? If you lead me correctly I am sure I can handle some dirty work :)

@MoOx
Copy link
Contributor Author

MoOx commented Jan 21, 2021

I have investigated on this a little bit and found a nice way to handle that (tell me if this works for you):

  • convert all icons as SVG files (including weight and size variation, that would give multiple SVG (like in the template exported from SF Symbols.app). A simple script with a regex (already wrote) can help to convert the big SVG provided by SF Symbols export to multiple SVG (on per icons)
  • To use SVG in React Native, I convert them with a simple package I made react-from-svg that will create pure React Native code that would need react-native-svg (I guess that's an acceptable tradeoff).

One (tiny) blocker:
I can't see how to easily export "brand" icons (the one like this)
image
We cannot use built-in export, so we will have to make them by hand (eg: drag & drop into sketch, convert as outline, then export as SVG, with variation that can be a "lot" of dirty work, which could also introduce human errors).

Another thing I see that using SVG will make it hard to respect the text baseline. With my regex to extract SVG, we totally lose the context. Maybe another solution would be more accurate to export the SVGs from a sliced template in Sketch ?

@MoOx MoOx mentioned this issue Jan 21, 2021
@andrew-levy
Copy link

@MoOx I have been doing a similar manual approach for my project right now. I think this would work, aside from the brand icons. Would you have to store all the svg files/converted RN SVGs in this project? Would that bloat the project too much?

@MoOx
Copy link
Contributor Author

MoOx commented Jan 31, 2021

According to the license, we cannot store them in the repo, I guess in any form, if I interpreted the license correctly.
So we would need a post install script or a manual user action (action that we could prepare via a script to make it less painful, via a local cache on the client machine etc). In all case, that will be limited to computer that runs on macOS with SF Symbols app installed.
Or we could find "a magic trick", to respect the license by not "sharing the icons". For example we could keep a huge "obfuscated blob" that contains all icons, but not "readable" and transform that in a build step (and obviously keeping this thing in low light to no get too much attention - not saying "secret" because it will not be, but we can try not to document this and keeping the "secret sauce" in the code only).

@lprhodes
Copy link

lprhodes commented Mar 7, 2022

Even without using actual SF symbols it would be nice to have a fallback option for when SF symbols is unavailable.

Wix implements something similar: https://wix.github.io/react-native-navigation/api/options-imageResource/

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