Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ - (void)didMoveToWindow
if (self.window != nil) {
[_helper registerForAccessoryFrameChanges];
} else {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about similar if in RNSTabsBottomAccessoryContentComponentView - we have (self.window != nil ? self : nil) threre. Maybe we should early return there if window is nil?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- (void)didMoveToWindow
{
  if (self.window == nil) {
    return;
  }
  
  if ([self.superview isKindOfClass:[RNSTabsBottomAccessoryComponentView class]]) {
    RNSTabsBottomAccessoryComponentView *accessoryView =
        static_cast<RNSTabsBottomAccessoryComponentView *>(self.superview);
    _accessoryView = accessoryView;
    [_accessoryView.helper setContentView:self forEnvironment:_environment];
  } else {
    [_accessoryView.helper setContentView:nil forEnvironment:_environment];
    _accessoryView = nil;
  }
}

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done: 90f9724

[self invalidate];
[_helper unregisterForAccessoryFrameChanges];
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,15 @@ - (instancetype)initWithFrame:(CGRect)frame

- (void)didMoveToWindow
{
if (self.window == nil) {
return;
}

if ([self.superview isKindOfClass:[RNSTabsBottomAccessoryComponentView class]]) {
RNSTabsBottomAccessoryComponentView *accessoryView =
static_cast<RNSTabsBottomAccessoryComponentView *>(self.superview);
_accessoryView = accessoryView;
[_accessoryView.helper setContentView:(self.window != nil ? self : nil) forEnvironment:_environment];
[_accessoryView.helper setContentView:self forEnvironment:_environment];
} else {
[_accessoryView.helper setContentView:nil forEnvironment:_environment];
_accessoryView = nil;
Expand Down
4 changes: 4 additions & 0 deletions ios/tabs/bottom-accessory/RNSTabsBottomAccessoryHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ API_AVAILABLE(ios(26.0))
* `RNSTabBarController`.
*/
- (void)registerForAccessoryFrameChanges;
/**
* Removes the KVO registration set up by `registerForAccessoryFrameChanges`.
*/
- (void)unregisterForAccessoryFrameChanges;
/**
* Invalidates observers, display link (if it is used); resets internal properties.
*/
Expand Down
Loading