Skip to content

Commit

Permalink
fix: add check for if container is null (#1375)
Browse files Browse the repository at this point in the history
Added check for if _container is nil which leads to app crash if invalidate was called before didMoveToWindow (e.g. navigating back from screen with navigation.goBack()).
  • Loading branch information
WoLewicki authored Mar 28, 2022
1 parent ef0e103 commit a12e257
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions ios/RNSFullWindowOverlay.m
Original file line number Diff line number Diff line change
Expand Up @@ -63,20 +63,13 @@ - (void)show
[window addSubview:_container];
}

- (void)hide
{
if (!_container) {
return;
}

[_container removeFromSuperview];
}

- (void)didMoveToWindow
{
if (self.window == nil) {
[self hide];
[_touchHandler detachFromView:_container];
if (_container != nil) {
[_container removeFromSuperview];
[_touchHandler detachFromView:_container];
}
} else {
if (_touchHandler == nil) {
_touchHandler = [[RCTTouchHandler alloc] initWithBridge:_bridge];
Expand All @@ -87,7 +80,7 @@ - (void)didMoveToWindow

- (void)invalidate
{
[self hide];
[_container removeFromSuperview];
_container = nil;
}

Expand Down

0 comments on commit a12e257

Please sign in to comment.