fix(iOS, TabsBottomAccessory): use hidden instead of opacity to switch bottom accessory content views#4196
Open
sgaczol wants to merge 2 commits into
Open
fix(iOS, TabsBottomAccessory): use hidden instead of opacity to switch bottom accessory content views#4196sgaczol wants to merge 2 commits into
sgaczol wants to merge 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
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.opacitytohidden. - Removes
traitCollectionDidChange:andfinalizeUpdates: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.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR changes the way the
RNSTabsBottomAccessorycontent-view switching workaround hides/shows its two content views: instead of mutatinglayer.opacity, it now togglesview.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
opacityfailed here (the values were already set before the animation started, yet both views still bled through) - most likelyhiddensimply 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 tohiddenresolves that (UIKit doesn't changehiddenon its own without reason).Changes
RNSTabsBottomAccessoryHelper: inhandleContentViewVisibilityForEnvironmentIfNeeded, swaplayer.opacityassignments forhidden(invisible →hidden = YES, visible →hidden = NO).RNSTabsBottomAccessoryContentComponentView: remove thetraitCollectionDidChange:andfinalizeUpdates:overrides that only existed to re-assert opacity afterinvalidateLayerreset it. These are redundant once visibility no longer relies onlayer.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
shownfromtruetofalseand back totrue. Confirm the two content views (regular & inline) don't overlap / show through each other.Checklist