Add macOS support - #1494
Add macOS support#1494
Conversation
|
@amgleitman Thank you so much for working on this! Looks like a huge undertaking. It's been one of the things holding me back from using rn-macos and this will help a lot |
|
@msand, can you take a look at this? |
Merge react-native-svg PR software-mansion#1494 into this fork
|
@amgleitman Do you have a published version of https://github.com/microsoft/react-native-svg-macos? |
@jacobp100 Not yet, but we're working on it. |
|
Ok. Thanks for your work on this! It'll be really helpful |
|
This is really impressive work! I hope to have some time and energy to dedicate to open source soon, becoming a father this spring, and our startup is growing quickly atm... |
To give us some flexibility with contributing to this repo, do you think it'd be possible to give @amgleitman write permissions so he can merge in the Mac support change? Either way, congrats on the startup and soon-to-be fathering! |
|
This is awesome! @msand do you have any thoughts to @HeyImChris 's question? |
|
I just added @amgleitman to the repository with write rights. Think I'll announce in a separate issue that this repo is looking for more maintainers and add a link to the readme. Thanks for any help in this! |
|
Thanks @msand! Can I assume that I have your blessing to merge this PR and help maintain this repo in the future? |
|
@amgleitman do you have the source code of the SVG content(all you show on screenshots)? I want to try to write tests for this library. |
I took the examples from the README file. |
i see :) thanks |
Summary
This adds macOS support to react-native-svg.
A good amount of code for react-native-svg iOS, such as constructing paths, is already platform-agnostic, but there were a few big things that needed to be resolved, mostly related to type differences between macOS and iOS (for example, importing
<UIKIt/UIKit.h>and differences betweenNSView/UIView,NSColor/UIColor, etc.), as well as a couple of iOS concepts that don't appear to have direct macOS equivalent (like-[UIView tintColor], which we use to determine what"currentColor"is).Most of the heavy lifting in resolving platform differences lies in RNSVGUIKit.h, which is a similar strategy to what react-native-macos does with RCTUIKit.h (found here).
Test Plan
To verify that nothing broke, I created a test app and confirmed that the example SVGs shown in this repo's README render exactly the same.
Screenshot Comparison
Compatibility
Checklist
README.md__tests__folder