Commit 51909226 authored by 7c00's avatar 7c00

Update iOS ReactSubview manager

parent 9688deed
......@@ -41,8 +41,7 @@
}
}
- (void)insertReactSubview:(id <RCTComponent>)subview atIndex:(NSInteger)atIndex {
dispatch_async(dispatch_get_main_queue(), ^{
- (void)didAddSubview:(UIView *)subview {
if ([subview isKindOfClass:[AMapMarker class]]) {
((AMapMarker *) subview).mapView = self;
[self addAnnotation:(id <MAAnnotation>) subview];
......@@ -50,20 +49,16 @@
if ([subview isKindOfClass:[AMapModel class]]) {
[self addOverlay:(id <MAOverlay>) subview];
}
[super insertReactSubview:subview atIndex:atIndex];
});
}
- (void)removeReactSubview:(id <RCTComponent>)subview {
dispatch_async(dispatch_get_main_queue(), ^{
[super removeReactSubview:subview];
if ([subview isKindOfClass:[AMapMarker class]]) {
[self removeAnnotation:(id <MAAnnotation>) subview];
}
if ([subview isKindOfClass:[AMapModel class]]) {
[self removeOverlay:(id <MAOverlay>) subview];
}
[super removeReactSubview:subview];
});
}
@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