refactor(ios): only invalidate foreignObject on did mount if not ready

This commit is contained in:
Mikael Sand
2020-01-12 01:31:16 +02:00
parent d54969846d
commit b5b1ececc0
3 changed files with 18 additions and 4 deletions

View File

@@ -40,12 +40,20 @@
- (void)uiManagerDidPerformMounting:(RCTUIManager *)manager
{
[manager addUIBlock:^(__unused RCTUIManager *uiManager, __unused NSDictionary<NSNumber *, UIView *> *viewRegistry) {
if (!self->_ready && !self.dirty) {
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];

View File

@@ -20,6 +20,7 @@
- (void)renderPathTo:(CGContextRef)context rect:(CGRect)rect;
- (void)renderGroupTo:(CGContextRef)context rect:(CGRect)rect;
- (void)renderChildTo:(CGContextRef)context rect:(CGRect)rect node:(UIView*)node;
- (RNSVGGlyphContext *)getGlyphContext;
- (void)pushGlyphContext;

View File

@@ -72,9 +72,7 @@
CGContextClipToRect(context, rect);
[svgView drawToContext:context withRect:rect];
} else {
node.hidden = false;
[node.layer renderInContext:context];
node.hidden = true;
[self renderChildTo:context rect:rect node:node];
}
return YES;
@@ -107,6 +105,13 @@
[self popGlyphContext];
}
- (void)renderChildTo:(CGContextRef)context rect:(CGRect)rect node:(UIView*)node
{
node.hidden = false;
[node.layer renderInContext:context];
node.hidden = true;
}
- (void)setupGlyphContext:(CGContextRef)context
{
CGRect clipBounds = CGContextGetClipBoundingBox(context);