From b092096450014f7a6d14d876ba94175089c76e75 Mon Sep 17 00:00:00 2001 From: moay Date: Thu, 5 Dec 2019 09:40:52 +0100 Subject: [PATCH 1/2] Fixes readme This line in the readme triggers a warning when running tests with jest. It should be updated to the new, correct import as promoted by expo. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ed0b337d..f5bc82f9 100644 --- a/README.md +++ b/README.md @@ -263,7 +263,7 @@ import Svg, { } from 'react-native-svg'; /* Use this if you are using Expo -import { Svg } from 'expo'; +import * as Svg from 'react-native-svg'; const { Circle, Rect } = Svg; */ From 6be3614d863d91cebcab1804e89dc5130dec0dca Mon Sep 17 00:00:00 2001 From: Jakub Adamczyk Date: Mon, 9 Dec 2019 16:06:28 +0100 Subject: [PATCH 2/2] fix memory font memory leaks iOS --- ios/Text/RNSVGGlyphContext.m | 5 ++++- ios/Text/RNSVGTSpan.m | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ios/Text/RNSVGGlyphContext.m b/ios/Text/RNSVGGlyphContext.m index c385e56a..1e3b61ca 100644 --- a/ios/Text/RNSVGGlyphContext.m +++ b/ios/Text/RNSVGGlyphContext.m @@ -191,7 +191,10 @@ CTFontDescriptorRef ctfd = (__bridge CTFontDescriptorRef)(uifd); CTFontDescriptorRef newfd = CTFontDescriptorCreateCopyWithVariation(ctfd, wght_id, (CGFloat)weight); CTFontRef newfont = CTFontCreateCopyWithAttributes(ref, size, nil, newfd); - return newfont; + + CFRelease(newfd); + + return (CTFontRef)CFAutorelease(newfont); } - (void)pushIndices diff --git a/ios/Text/RNSVGTSpan.m b/ios/Text/RNSVGTSpan.m index 16b94c40..0888b3f9 100644 --- a/ios/Text/RNSVGTSpan.m +++ b/ios/Text/RNSVGTSpan.m @@ -140,6 +140,9 @@ static CGFloat RNSVGTSpan_radToDeg = 180 / (CGFloat)M_PI; TopAlignedLabel *label; - (void)drawWrappedText:(CGContextRef)context gc:(RNSVGGlyphContext *)gc rect:(CGRect)rect { [self pushGlyphContext]; + if (fontRef != nil) { + CFRelease(fontRef); + } fontRef = [self getFontFromContext]; RNSVGFontData* fontdata = [gc getFont]; CFStringRef string = (__bridge CFStringRef)self.content;