diff --git a/ios/Elements/RNSVGSvgView.m b/ios/Elements/RNSVGSvgView.m index 7ab22dcd..b364c784 100644 --- a/ios/Elements/RNSVGSvgView.m +++ b/ios/Elements/RNSVGSvgView.m @@ -16,6 +16,24 @@ NSMutableDictionary *clipPaths; } +- (void)insertReactSubview:(UIView *)subview atIndex:(NSInteger)atIndex +{ + [super insertReactSubview:subview atIndex:atIndex]; + [self insertSubview:subview atIndex:atIndex]; + [self invalidate]; +} + +- (void)removeReactSubview:(UIView *)subview +{ + [super removeReactSubview:subview]; + [self invalidate]; +} + +- (void)didUpdateReactSubviews +{ + // Do nothing, as subviews are inserted by insertReactSubview: +} + - (void)invalidate { [self setNeedsDisplay]; diff --git a/ios/RNSVGNode.h b/ios/RNSVGNode.h index eee3469a..bda04948 100644 --- a/ios/RNSVGNode.h +++ b/ios/RNSVGNode.h @@ -6,8 +6,7 @@ * LICENSE file in the root directory of this source tree. */ -#import -#import +#import "UIView+React.h" #import "RNSVGCGFCRule.h" #import "RNSVGSvgView.h" diff --git a/ios/RNSVGNode.m b/ios/RNSVGNode.m index ea844529..8e63709d 100644 --- a/ios/RNSVGNode.m +++ b/ios/RNSVGNode.m @@ -12,16 +12,22 @@ @implementation RNSVGNode -- (void)insertSubview:(UIView *)subview atIndex:(NSInteger)index +- (void)insertReactSubview:(UIView *)subview atIndex:(NSInteger)atIndex { + [super insertReactSubview:subview atIndex:atIndex]; + [self insertSubview:subview atIndex:atIndex]; [self invalidate]; - [super insertSubview:subview atIndex:index]; } -- (void)removeFromSuperview +- (void)removeReactSubview:(UIView *)subview { + [super removeReactSubview:subview]; [self invalidate]; - [super removeFromSuperview]; +} + +- (void)didUpdateReactSubviews +{ + // Do nothing, as subviews are inserted by insertReactSubview: } - (void)setOpacity:(CGFloat)opacity