diff --git a/ios/Elements/RNSVGForeignObject.h b/ios/Elements/RNSVGForeignObject.h index c3f793ff..7d6fb2c0 100644 --- a/ios/Elements/RNSVGForeignObject.h +++ b/ios/Elements/RNSVGForeignObject.h @@ -5,7 +5,6 @@ @interface RNSVGForeignObject : RNSVGGroup -- (instancetype)initWithEventDispatcher:(RCTEventDispatcher *)eventDispatcher; @property (nonatomic, strong) RNSVGLength *x; @property (nonatomic, strong) RNSVGLength *y; @property (nonatomic, strong) RNSVGLength *foreignObjectwidth; diff --git a/ios/Elements/RNSVGForeignObject.m b/ios/Elements/RNSVGForeignObject.m index 2371f957..e2a7b80d 100644 --- a/ios/Elements/RNSVGForeignObject.m +++ b/ios/Elements/RNSVGForeignObject.m @@ -7,53 +7,19 @@ */ #import "RNSVGForeignObject.h" #import "RNSVGNode.h" -#import "RCTUIManager.h" -#import "RCTUIManagerObserverCoordinator.h" @implementation RNSVGForeignObject -{ - RCTEventDispatcher *_eventDispatcher; - bool _ready; -} - (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event { return nil; } -- (instancetype)initWithEventDispatcher:(RCTEventDispatcher *)eventDispatcher -{ - RCTAssertParam(eventDispatcher); - - if ((self = [super init])) { - _eventDispatcher = eventDispatcher; - [_eventDispatcher.bridge.uiManager.observerCoordinator addObserver:self]; - } - return self; -} - - (void)parseReference { self.dirty = false; } -- (void)uiManagerDidPerformMounting:(RCTUIManager *)manager -{ - [manager addUIBlock:^(__unused RCTUIManager *uiManager, __unused NSDictionary *viewRegistry) { - if (!self->_ready) { - [self invalidate]; - } - }]; -} - -- (void)renderChildTo:(CGContextRef)context rect:(CGRect)rect node:(UIView*)node -{ - node.hidden = false; - self->_ready = [node drawViewHierarchyInRect:rect afterScreenUpdates:true]; - [node.layer renderInContext:context]; - node.hidden = true; -} - - (void)renderLayerTo:(CGContextRef)context rect:(CGRect)rect { [self clip:context]; diff --git a/ios/Elements/RNSVGGroup.m b/ios/Elements/RNSVGGroup.m index 673c8393..e7b8bce1 100644 --- a/ios/Elements/RNSVGGroup.m +++ b/ios/Elements/RNSVGGroup.m @@ -72,7 +72,9 @@ CGContextClipToRect(context, rect); [svgView drawToContext:context withRect:rect]; } else { - [self renderChildTo:context rect:rect node:node]; + node.hidden = false; + [node.layer renderInContext:context]; + node.hidden = true; } return YES; @@ -105,11 +107,9 @@ [self popGlyphContext]; } -- (void)renderChildTo:(CGContextRef)context rect:(CGRect)rect node:(UIView*)node +- (void)drawRect:(CGRect)rect { - node.hidden = false; - [node.layer renderInContext:context]; - node.hidden = true; + [self invalidate]; } - (void)setupGlyphContext:(CGContextRef)context diff --git a/ios/ViewManagers/RNSVGForeignObjectManager.m b/ios/ViewManagers/RNSVGForeignObjectManager.m index 58841fb4..c7acbec1 100644 --- a/ios/ViewManagers/RNSVGForeignObjectManager.m +++ b/ios/ViewManagers/RNSVGForeignObjectManager.m @@ -15,7 +15,7 @@ RCT_EXPORT_MODULE() - (RNSVGForeignObject *)node { - return [[RNSVGForeignObject alloc] initWithEventDispatcher:self.bridge.eventDispatcher]; + return [RNSVGForeignObject new]; } RCT_EXPORT_VIEW_PROPERTY(x, RNSVGLength*)