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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this the issue? Shouldn't this be set to
[self bounds]
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That didn't seem to have any effect in my testing.
The remaining issue I found is that SVG images will still render with a large width/height and not properly clip. Tracing the callstack , I got the issue to to this method in RNSVGGroups.mm:
CGContextGetClipBoundingBox
returns an abnormally large box. My next step is to compare what it returns when compiled against Xcode 14/macOS 13There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you ever figure out what was going on for your case? We were seeing a similar issue where SVGImages weren't rendering properly, except for us
CGContextGetClipBoundingBox
at that point was abnormally small, withwidth
andheight
of 1.I'm not too familiar with Apple APIs, but the farthest I got was noticing that the abnormal context came from the call to
UIGraphicsGetCurrentContext
. Before I could investigate further, we suddenly started getting reasonable bounding boxes and I was no longer able to reproduce 😕.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not get any further. Might be worth filing a Github issue to track. I'm curious what your use case is?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're loading an image and then drawing annotations that a user specified using SVGs, basically.
I'll try to file another issue once we start seeing it again, but it unfortunately (fortunately?) seems to work on my machine™.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW, the method you linked is a UIKit (aka, iOS only) method we shim on macOS: https://github.com/microsoft/react-native-macos/blob/2fe53e8050a9c0b0906c0e092764ffdebcc039d4/packages/react-native/React/Base/macOS/RCTUIKit.m#L29-L32
I've been meaning to revisit some of these shims, but ultimately I think it would call the same underlying NSGraphicsContext code. I couldn't find any apple docs about
CGContextGetClipBoundingBox
changing, but It very much feels like this method also had a breaking change with Xcode 15 / the macOS 14 SDK.