Skip to content

Commit 886be0a

Browse files
committed
Guard before removing
1 parent 075f8e4 commit 886be0a

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

packages/react-native-gesture-handler/apple/RNGestureHandlerButtonComponentView.mm

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,12 @@ - (void)mountChildComponentView:(RNGHUIView<RCTComponentViewProtocol> *)childCom
7272
[_buttonView mountChildComponentView:childComponentView index:index];
7373
}
7474

75-
- (void)unmountChildComponentView:(RNGHUIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index
75+
- (void)unmountChildComponentView:(RNGHUIView<RCTComponentViewProtocol> *)childComponentView
76+
index:(NSInteger)__unused index
7677
{
77-
[childComponentView removeFromSuperview];
78+
if (childComponentView.superview == _buttonView) {
79+
[childComponentView removeFromSuperview];
80+
}
7881
}
7982

8083
- (LayoutMetrics)buildWrapperMetrics:(const LayoutMetrics &)metrics

0 commit comments

Comments
 (0)