Skip to content

Commit b4cc590

Browse files
fix: change __bridge with __bridge_retained to fix Pattern usage crash on macos
1 parent 6bb303e commit b4cc590

2 files changed

Lines changed: 10 additions & 33 deletions

File tree

apple/Brushes/RNSVGPainter.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ - (void)paintPattern:(CGContextRef)context bounds:(CGRect)bounds
172172
CGColorSpaceRelease(patternSpace);
173173

174174
CGPatternRef pattern = CGPatternCreate(
175-
(__bridge void *_Nullable)(self),
175+
(__bridge_retained void *_Nullable)(self),
176176
newBounds,
177177
viewbox,
178178
size.width,

apps/common/example/examples/Transforms.tsx

Lines changed: 9 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -132,40 +132,17 @@ GradientTransformExample.title = 'Gradient transform';
132132

133133
const icon = (
134134
<Svg height="30" width="30" viewBox="0 0 100 100">
135-
{Platform.OS === 'macos' ? (
136-
<>
137-
<RadialGradient
138-
id="gradient1"
139-
gradientUnits="userSpaceOnUse"
140-
cx="100"
141-
cy="100"
142-
r="100"
143-
fx="100"
144-
fy="100">
145-
<Stop offset="0%" stopColor="darkblue" />
146-
<Stop offset="50%" stopColor="skyblue" />
147-
<Stop offset="100%" stopColor="darkblue" />
148-
</RadialGradient>
149-
<Rect x="10" y="10" width="80" height="80" fill="url(#gradient1)" />
150-
</>
151-
) : (
152-
<>
153-
<Pattern
154-
id="p1"
155-
width="0.25"
156-
height="0.25"
157-
patternTransform="rotate(20) skewX(30) scale(1 0.5)">
158-
<Circle fill="black" cx="10" cy="10" r="10" />
159-
</Pattern>
160-
<Rect x="10" y="10" width="80" height="80" fill="url(#p1)" />
161-
</>
162-
)}
135+
<Pattern
136+
id="p1"
137+
width="0.25"
138+
height="0.25"
139+
patternTransform="rotate(20) skewX(30) scale(1 0.5)">
140+
<Circle fill="black" cx="10" cy="10" r="10" />
141+
</Pattern>
142+
<Rect x="10" y="10" width="80" height="80" fill="url(#p1)" />
163143
</Svg>
164144
);
165-
const samples = [GradientTransformExample];
166145

167-
if (Platform.OS !== 'macos') {
168-
samples.push(PatternTransformExample);
169-
}
146+
const samples = [PatternTransformExample, GradientTransformExample];
170147

171148
export {icon, samples};

0 commit comments

Comments
 (0)