Skip to content

Commit

Permalink
ios(fabric): fix marker view (#3341)
Browse files Browse the repository at this point in the history
  • Loading branch information
mfazekas authored Feb 3, 2024
1 parent 13ea927 commit 6d2309b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 22 deletions.
18 changes: 5 additions & 13 deletions ios/RNMBX/RNMBXMarkerViewComponentView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ - (instancetype)initWithFrame:(CGRect)frame
if (self = [super initWithFrame:frame]) {
static const auto defaultProps = std::make_shared<const RNMBXMarkerViewProps>();
_props = defaultProps;
[self prepareView];
[self prepareView];
}

return self;
Expand All @@ -39,26 +39,18 @@ - (void)prepareView

- (void)prepareForRecycle
{
[super prepareForRecycle];
[self prepareView];
[super prepareForRecycle];
[self prepareView];
}

- (void)mountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index
{
if ([childComponentView isKindOfClass:[RCTViewComponentView class]] && ((RCTViewComponentView *)childComponentView).contentView != nil) {
[_view insertSubview:((RCTViewComponentView *)childComponentView).contentView atIndex:index];
} else {
[_view insertSubview:childComponentView atIndex:index];
}
[_view insertSubview:childComponentView atIndex:index];
}

- (void)unmountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index
{
if ([childComponentView isKindOfClass:[RCTViewComponentView class]] && ((RCTViewComponentView *)childComponentView).contentView != nil) {
[((RCTViewComponentView *)childComponentView).contentView removeFromSuperview];
} else {
[childComponentView removeFromSuperview];
}
[childComponentView removeFromSuperview];
}

#pragma mark - RCTComponentViewProtocol
Expand Down
11 changes: 2 additions & 9 deletions ios/RNMBX/RNMBXMarkerViewContentComponentView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,20 @@ @interface RNMBXMarkerViewContentComponentView () <RCTRNMBXMarkerViewContentView
@end

@implementation RNMBXMarkerViewContentComponentView {
RNMBXMarkerView *_view;
UIView *_view;
CGRect _frame;
}

- (instancetype)initWithFrame:(CGRect)frame
{
if (self = [super initWithFrame:frame]) {
static const auto defaultProps = std::make_shared<const RNMBXMarkerViewProps>();
static const auto defaultProps = std::make_shared<const RNMBXMarkerViewContentProps>();
_props = defaultProps;
_frame = frame;
[self prepareView];
}
return self;
}

- (void)prepareView
{
_view = [[RNMBXMarkerView alloc] initWithFrame:_frame];
self.contentView = _view;
}

#pragma mark - RCTComponentViewProtocol

+ (ComponentDescriptorProvider)componentDescriptorProvider
Expand Down

0 comments on commit 6d2309b

Please sign in to comment.