Merge react-native-svg PR #1494 into this fork #1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
(copied from original PR)
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