mirror of
https://github.com/zoriya/react-native-svg.git
synced 2026-06-05 07:59:28 +00:00
fix(ios): initial render foreignObject / re-render on mount of sub views
This commit is contained in:
@@ -1,9 +1,11 @@
|
|||||||
|
|
||||||
#import "RNSVGGroup.h"
|
#import "RNSVGGroup.h"
|
||||||
#import "RNSVGLength.h"
|
#import "RNSVGLength.h"
|
||||||
|
#import "RCTEventDispatcher.h"
|
||||||
|
|
||||||
@interface RNSVGForeignObject : RNSVGGroup
|
@interface RNSVGForeignObject : RNSVGGroup
|
||||||
|
|
||||||
|
- (instancetype)initWithEventDispatcher:(RCTEventDispatcher *)eventDispatcher;
|
||||||
@property (nonatomic, strong) RNSVGLength *x;
|
@property (nonatomic, strong) RNSVGLength *x;
|
||||||
@property (nonatomic, strong) RNSVGLength *y;
|
@property (nonatomic, strong) RNSVGLength *y;
|
||||||
@property (nonatomic, strong) RNSVGLength *foreignObjectwidth;
|
@property (nonatomic, strong) RNSVGLength *foreignObjectwidth;
|
||||||
|
|||||||
@@ -7,19 +7,45 @@
|
|||||||
*/
|
*/
|
||||||
#import "RNSVGForeignObject.h"
|
#import "RNSVGForeignObject.h"
|
||||||
#import "RNSVGNode.h"
|
#import "RNSVGNode.h"
|
||||||
|
#import "RCTUIManager.h"
|
||||||
|
#import "RCTUIManagerObserverCoordinator.h"
|
||||||
|
|
||||||
@implementation RNSVGForeignObject
|
@implementation RNSVGForeignObject
|
||||||
|
{
|
||||||
|
RCTEventDispatcher *_eventDispatcher;
|
||||||
|
bool _ready;
|
||||||
|
}
|
||||||
|
|
||||||
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
|
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
|
||||||
{
|
{
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (instancetype)initWithEventDispatcher:(RCTEventDispatcher *)eventDispatcher
|
||||||
|
{
|
||||||
|
RCTAssertParam(eventDispatcher);
|
||||||
|
|
||||||
|
if ((self = [super init])) {
|
||||||
|
_eventDispatcher = eventDispatcher;
|
||||||
|
[_eventDispatcher.bridge.uiManager.observerCoordinator addObserver:self];
|
||||||
|
}
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
- (void)parseReference
|
- (void)parseReference
|
||||||
{
|
{
|
||||||
self.dirty = false;
|
self.dirty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)uiManagerDidPerformMounting:(RCTUIManager *)manager
|
||||||
|
{
|
||||||
|
[manager addUIBlock:^(__unused RCTUIManager *uiManager, __unused NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
||||||
|
if (!self->_ready && !self.dirty) {
|
||||||
|
[self invalidate];
|
||||||
|
}
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
|
||||||
- (void)renderLayerTo:(CGContextRef)context rect:(CGRect)rect
|
- (void)renderLayerTo:(CGContextRef)context rect:(CGRect)rect
|
||||||
{
|
{
|
||||||
[self clip:context];
|
[self clip:context];
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ RCT_EXPORT_MODULE()
|
|||||||
|
|
||||||
- (RNSVGForeignObject *)node
|
- (RNSVGForeignObject *)node
|
||||||
{
|
{
|
||||||
return [RNSVGForeignObject new];
|
return [[RNSVGForeignObject alloc] initWithEventDispatcher:self.bridge.eventDispatcher];
|
||||||
}
|
}
|
||||||
|
|
||||||
RCT_EXPORT_VIEW_PROPERTY(x, RNSVGLength*)
|
RCT_EXPORT_VIEW_PROPERTY(x, RNSVGLength*)
|
||||||
|
|||||||
Reference in New Issue
Block a user