From 727a2d093732f947751e3b81b99904823353bde8 Mon Sep 17 00:00:00 2001 From: Mark Lord Date: Wed, 6 Feb 2019 11:06:01 +0000 Subject: [PATCH 1/4] During a LayoutAnimation.spring animation it's possible for the SvgView to have negative layout dimensions when used with 100% width/height. Check for negative dimensions before calling Bitmap.createBitmap. --- android/src/main/java/com/horcrux/svg/SvgView.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/android/src/main/java/com/horcrux/svg/SvgView.java b/android/src/main/java/com/horcrux/svg/SvgView.java index 1e6f6ea7..bac74dbd 100644 --- a/android/src/main/java/com/horcrux/svg/SvgView.java +++ b/android/src/main/java/com/horcrux/svg/SvgView.java @@ -234,7 +234,7 @@ public class SvgView extends ReactViewGroup implements ReactCompoundView, ReactC height = (float) PropHelper.fromRelative(mbbHeight, parentHeight, 0, mScale, 12); setMeasuredDimension((int)Math.ceil(width), (int)Math.ceil(height)); } - if (width == 0 || height == 0) { + if (width <= 0 || height <= 0) { return null; } Bitmap bitmap = Bitmap.createBitmap( From a841eec7b50dc2bd3693b35d7c3c1a124ec8d158 Mon Sep 17 00:00:00 2001 From: Alex Lau Date: Thu, 7 Feb 2019 23:28:12 +0800 Subject: [PATCH 2/4] [ios] Fix active filtering in hitTest to return the last (top-most) view --- ios/Elements/RNSVGGroup.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ios/Elements/RNSVGGroup.m b/ios/Elements/RNSVGGroup.m index 803a209a..3730079e 100644 --- a/ios/Elements/RNSVGGroup.m +++ b/ios/Elements/RNSVGGroup.m @@ -169,7 +169,7 @@ NSPredicate *const anyActive = [NSPredicate predicateWithFormat:@"active == TRUE"]; NSArray *const filtered = [self.subviews filteredArrayUsingPredicate:anyActive]; if ([filtered count] != 0) { - return [filtered.firstObject hitTest:transformed withEvent:event]; + return [filtered.lastObject hitTest:transformed withEvent:event]; } } From 9e516a2098d8772b63b1b084d0209ad1e2433454 Mon Sep 17 00:00:00 2001 From: Mikael Sand Date: Sat, 9 Feb 2019 03:18:40 +0200 Subject: [PATCH 3/4] Revert #755 Attempt to fix issues with removeChildren and manageChildren bugs, causing exceptions from RCTUIManager Related to #258 and #848 https://github.com/facebook/react-native/issues/23350 https://github.com/FormidableLabs/victory-native/issues/432 https://github.com/indiespirit/react-native-chart-kit/issues/62 https://github.com/JesperLekland/react-native-svg-charts/pull/280 https://github.com/JesperLekland/react-native-svg-charts/issues/244 --- ios/ViewManagers/RNSVGNodeManager.m | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ios/ViewManagers/RNSVGNodeManager.m b/ios/ViewManagers/RNSVGNodeManager.m index 1eca8fb2..3fd1e231 100644 --- a/ios/ViewManagers/RNSVGNodeManager.m +++ b/ios/ViewManagers/RNSVGNodeManager.m @@ -151,6 +151,11 @@ RCT_EXPORT_MODULE() return [self node]; } +- (RCTShadowView *)shadowView +{ + return nil; +} + RCT_EXPORT_VIEW_PROPERTY(name, NSString) RCT_EXPORT_VIEW_PROPERTY(opacity, CGFloat) RCT_EXPORT_VIEW_PROPERTY(matrix, CGAffineTransform) From 8fb377022b8baa30ef3a31ebb62a30348b187b72 Mon Sep 17 00:00:00 2001 From: Mikael Sand Date: Sat, 9 Feb 2019 03:42:24 +0200 Subject: [PATCH 4/4] Revert Revert #755 and fix actual root cause instead. Fixed issues with removeChildren and manageChildren bugs, causing exceptions from RCTUIManager Related to #258 and #848 https://github.com/facebook/react-native/issues/23350 https://github.com/FormidableLabs/victory-native/issues/432 https://github.com/indiespirit/react-native-chart-kit/issues/62 https://github.com/JesperLekland/react-native-svg-charts/pull/280 https://github.com/JesperLekland/react-native-svg-charts/issues/244 --- ios/ViewManagers/RNSVGDefsManager.m | 5 ----- ios/ViewManagers/RNSVGNodeManager.m | 5 ----- 2 files changed, 10 deletions(-) diff --git a/ios/ViewManagers/RNSVGDefsManager.m b/ios/ViewManagers/RNSVGDefsManager.m index d6eccd83..8c1e86ad 100644 --- a/ios/ViewManagers/RNSVGDefsManager.m +++ b/ios/ViewManagers/RNSVGDefsManager.m @@ -23,9 +23,4 @@ RCT_EXPORT_MODULE() return [self node]; } -- (RCTShadowView *)shadowView -{ - return nil; -} - @end diff --git a/ios/ViewManagers/RNSVGNodeManager.m b/ios/ViewManagers/RNSVGNodeManager.m index 3fd1e231..1eca8fb2 100644 --- a/ios/ViewManagers/RNSVGNodeManager.m +++ b/ios/ViewManagers/RNSVGNodeManager.m @@ -151,11 +151,6 @@ RCT_EXPORT_MODULE() return [self node]; } -- (RCTShadowView *)shadowView -{ - return nil; -} - RCT_EXPORT_VIEW_PROPERTY(name, NSString) RCT_EXPORT_VIEW_PROPERTY(opacity, CGFloat) RCT_EXPORT_VIEW_PROPERTY(matrix, CGAffineTransform)