Commit 51909226 authored by 7c00's avatar 7c00

Update iOS ReactSubview manager

parent 9688deed
...@@ -41,29 +41,24 @@ ...@@ -41,29 +41,24 @@
} }
} }
- (void)insertReactSubview:(id <RCTComponent>)subview atIndex:(NSInteger)atIndex { - (void)didAddSubview:(UIView *)subview {
dispatch_async(dispatch_get_main_queue(), ^{ if ([subview isKindOfClass:[AMapMarker class]]) {
if ([subview isKindOfClass:[AMapMarker class]]) { ((AMapMarker *) subview).mapView = self;
((AMapMarker *) subview).mapView = self; [self addAnnotation:(id <MAAnnotation>) subview];
[self addAnnotation:(id <MAAnnotation>) subview]; }
} if ([subview isKindOfClass:[AMapModel class]]) {
if ([subview isKindOfClass:[AMapModel class]]) { [self addOverlay:(id <MAOverlay>) subview];
[self addOverlay:(id <MAOverlay>) subview]; }
}
[super insertReactSubview:subview atIndex:atIndex];
});
} }
- (void)removeReactSubview:(id <RCTComponent>)subview { - (void)removeReactSubview:(id <RCTComponent>)subview {
dispatch_async(dispatch_get_main_queue(), ^{ [super removeReactSubview:subview];
if ([subview isKindOfClass:[AMapMarker class]]) { if ([subview isKindOfClass:[AMapMarker class]]) {
[self removeAnnotation:(id <MAAnnotation>) subview]; [self removeAnnotation:(id <MAAnnotation>) subview];
} }
if ([subview isKindOfClass:[AMapModel class]]) { if ([subview isKindOfClass:[AMapModel class]]) {
[self removeOverlay:(id <MAOverlay>) subview]; [self removeOverlay:(id <MAOverlay>) subview];
} }
[super removeReactSubview:subview];
});
} }
@end @end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment