Skip to content

Commit

Permalink
fix(ios): error in move node operation of ViewPager
Browse files Browse the repository at this point in the history
  • Loading branch information
wwwcg committed May 22, 2024
1 parent 70c4626 commit dad8fb0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,11 @@ - (void)insertHippySubview:(HippyShadowView *)subview atIndex:(NSUInteger)atInde
}

- (void)moveHippySubview:(id<HippyComponent>)subview toIndex:(NSUInteger)atIndex {
if ([_objectSubviews containsObject:subview]) {
[_objectSubviews removeObject:subview];
if (!subview) {
HippyAssert(subview != nil, @"subview should not be nil!");
return;
}
[self removeHippySubview:subview];
[self insertHippySubview:subview atIndex:atIndex];
}

Expand Down
8 changes: 1 addition & 7 deletions renderer/native/ios/renderer/component/view/UIView+Hippy.mm
Original file line number Diff line number Diff line change
Expand Up @@ -182,13 +182,7 @@ - (void)moveHippySubview:(UIView *)subview toIndex:(NSUInteger)atIndex {
if (nil == subview) {
return;
}
NSMutableArray *subviews = objc_getAssociatedObject(self, @selector(subcomponents));
if (!subviews) {
return;
}
if ([subviews containsObject:subview]) {
[subviews removeObject:subview];
}
[self removeHippySubview:subview];
[self insertHippySubview:subview atIndex:atIndex];
}

Expand Down

0 comments on commit dad8fb0

Please sign in to comment.