Skip to content

fix(iOS, TabsBottomAccessory): use hidden instead of opacity to switch bottom accessory content views#4196

Open
sgaczol wants to merge 2 commits into
mainfrom
@sgaczol/tabsbottomaccessory-hidden
Open

fix(iOS, TabsBottomAccessory): use hidden instead of opacity to switch bottom accessory content views#4196
sgaczol wants to merge 2 commits into
mainfrom
@sgaczol/tabsbottomaccessory-hidden

Conversation

@sgaczol

@sgaczol sgaczol commented Jun 19, 2026

Copy link
Copy Markdown
Collaborator

Description

This PR changes the way the RNSTabsBottomAccessory content-view switching workaround hides/shows its two content views: instead of mutating layer.opacity, it now toggles view.hidden.

Such approach fixes a bug where, during the bottom accessory's appearance animation, both content views (regular & inline) showed through each other instead of just the one matching the current environment. We don't fully understand why opacity failed here (the values were already set before the animation started, yet both views still bled through) - most likely hidden simply doesn't participate in the animation at all, which is what fixes it.

We initially considered adding KVO on layer.opacity, since we weren't sure whether UIKit was changing it under us, but switching to hidden resolves that (UIKit doesn't change hidden on its own without reason).

Changes

  • RNSTabsBottomAccessoryHelper: in handleContentViewVisibilityForEnvironmentIfNeeded, swap layer.opacity assignments for hidden (invisible → hidden = YES, visible → hidden = NO).
  • RNSTabsBottomAccessoryContentComponentView: remove the traitCollectionDidChange: and finalizeUpdates: overrides that only existed to re-assert opacity after invalidateLayer reset it. These are redundant once visibility no longer relies on layer.opacity.

Before & after - visual documentation

Before

before.mov
bar.before.mov

After

after.mov
bar.after.mov

Test plan

Run the 3288 issue test. Toggle shown from true to false and back to true. Confirm the two content views (regular & inline) don't overlap / show through each other.

Checklist

  • Included code example that can be used to test this change.
  • For visual changes, included screenshots / GIFs / recordings documenting the change.
  • For API changes, updated relevant public types.
  • Ensured that CI passes

Copilot AI left a comment

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.

Pull request overview

This PR fixes an iOS TabsBottomAccessory rendering glitch by changing the content-view switching workaround to toggle UIView.hidden instead of mutating layer.opacity, avoiding the two content views bleeding through each other during appearance animations.

Changes:

  • Switches the visibility mechanism for the regular/inline content views from layer.opacity to hidden.
  • Removes traitCollectionDidChange: and finalizeUpdates: overrides that only existed to re-assert opacity after layer invalidation.
  • Updates associated inline documentation to match the new behavior.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
ios/tabs/bottom-accessory/RNSTabsBottomAccessoryHelper.mm Uses hidden toggling to show exactly one content view for the active tab accessory environment.
ios/tabs/bottom-accessory/RNSTabsBottomAccessoryHelper.h Updates docs to describe hidden-based switching (and includes a small typo fix suggestion).
ios/tabs/bottom-accessory/RNSTabsBottomAccessoryContentComponentView.mm Removes now-unnecessary overrides that were compensating for opacity resets during layer invalidation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread ios/tabs/bottom-accessory/RNSTabsBottomAccessoryHelper.h Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants