Skip to content

Commit 6d2309b

Browse files
authored
ios(fabric): fix marker view (#3341)
1 parent 13ea927 commit 6d2309b

File tree

2 files changed

+7
-22
lines changed

2 files changed

+7
-22
lines changed

ios/RNMBX/RNMBXMarkerViewComponentView.mm

+5-13
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ - (instancetype)initWithFrame:(CGRect)frame
2525
if (self = [super initWithFrame:frame]) {
2626
static const auto defaultProps = std::make_shared<const RNMBXMarkerViewProps>();
2727
_props = defaultProps;
28-
[self prepareView];
28+
[self prepareView];
2929
}
3030

3131
return self;
@@ -39,26 +39,18 @@ - (void)prepareView
3939

4040
- (void)prepareForRecycle
4141
{
42-
[super prepareForRecycle];
43-
[self prepareView];
42+
[super prepareForRecycle];
43+
[self prepareView];
4444
}
4545

4646
- (void)mountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index
4747
{
48-
if ([childComponentView isKindOfClass:[RCTViewComponentView class]] && ((RCTViewComponentView *)childComponentView).contentView != nil) {
49-
[_view insertSubview:((RCTViewComponentView *)childComponentView).contentView atIndex:index];
50-
} else {
51-
[_view insertSubview:childComponentView atIndex:index];
52-
}
48+
[_view insertSubview:childComponentView atIndex:index];
5349
}
5450

5551
- (void)unmountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index
5652
{
57-
if ([childComponentView isKindOfClass:[RCTViewComponentView class]] && ((RCTViewComponentView *)childComponentView).contentView != nil) {
58-
[((RCTViewComponentView *)childComponentView).contentView removeFromSuperview];
59-
} else {
60-
[childComponentView removeFromSuperview];
61-
}
53+
[childComponentView removeFromSuperview];
6254
}
6355

6456
#pragma mark - RCTComponentViewProtocol

ios/RNMBX/RNMBXMarkerViewContentComponentView.mm

+2-9
Original file line numberDiff line numberDiff line change
@@ -17,27 +17,20 @@ @interface RNMBXMarkerViewContentComponentView () <RCTRNMBXMarkerViewContentView
1717
@end
1818

1919
@implementation RNMBXMarkerViewContentComponentView {
20-
RNMBXMarkerView *_view;
20+
UIView *_view;
2121
CGRect _frame;
2222
}
2323

2424
- (instancetype)initWithFrame:(CGRect)frame
2525
{
2626
if (self = [super initWithFrame:frame]) {
27-
static const auto defaultProps = std::make_shared<const RNMBXMarkerViewProps>();
27+
static const auto defaultProps = std::make_shared<const RNMBXMarkerViewContentProps>();
2828
_props = defaultProps;
2929
_frame = frame;
30-
[self prepareView];
3130
}
3231
return self;
3332
}
3433

35-
- (void)prepareView
36-
{
37-
_view = [[RNMBXMarkerView alloc] initWithFrame:_frame];
38-
self.contentView = _view;
39-
}
40-
4134
#pragma mark - RCTComponentViewProtocol
4235

4336
+ (ComponentDescriptorProvider)componentDescriptorProvider

0 commit comments

Comments
 (0)