feat(ios): add backgroundColor prop to top bar buttons#8301
Open
IsaacIsrael wants to merge 3 commits into
Open
feat(ios): add backgroundColor prop to top bar buttons#8301IsaacIsrael wants to merge 3 commits into
IsaacIsrael wants to merge 3 commits into
Conversation
1 task
On iOS 26 the Liquid Glass navigation bar wraps custom-view bar button items in several internal layout containers. Without explicit size constraints the wrapper views can collapse to zero height after a pop → tab-switch → tab-switch → push cycle, making the React button invisible. - Guard all new logic behind @available(iOS 26.0, *) AND a runtime check for UIDesignRequiresCompatibility (compatibility mode disables Liquid Glass and uses the legacy view hierarchy) - Set translatesAutoresizingMaskIntoConstraints = NO - Add width/height constraints at UILayoutPriorityDefaultHigh - Update constraints in didMountComponentsWithRootTag: after sizeToFit Co-authored-by: Cursor <cursoragent@cursor.com>
On iOS 26 the internal _UITAMICAdaptorView wrapper is wider than the React button content and UIKit pins the custom view to the leading edge. Apply a one-time horizontal CGAffineTransform in layoutSubviews to center the view. Guarded by @available(iOS 26.0, *) and UIDesignRequiresCompatibility check. Co-authored-by: Cursor <cursoragent@cursor.com>
Add a new `backgroundColor` option to `OptionsTopBarButton` that sets a solid color on the iOS 26 Liquid Glass circular platter behind React component bar buttons. All logic is guarded by @available(iOS 26.0, *) and a runtime check for UIDesignRequiresCompatibility — when compatibility mode is enabled the prop is ignored and the button renders as before. Co-authored-by: Cursor <cursoragent@cursor.com>
982ab4a to
70207b6
Compare
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.
Problem
On iOS 26, React Native Navigation exposes no way to set a solid background color on the circular Liquid Glass platter that UIKit draws behind each bar button item. Apps may want to highlight specific buttons (e.g., a primary action) with a colored background.
Solution
Add a new
backgroundColorproperty toOptionsTopBarButton(TypeScript) andRNNButtonOptions(native) that sets a solidUIColoron the platter container view behind React component bar buttons.Native changes
backgroundColor(Color)[button.backgroundColor withDefault:nil]toRNNReactButtonView.buttonBackgroundColorbuttonBackgroundColorpropertysyncButtonBackgroundmethod targets the_UINavigationBarPlatterSubviewContainerView(self.superview.superview.superview) and applies:backgroundColor(orclearColorwhen nil — prevents color leaking between buttons)cornerRadius = bounds.height / 2to maintain the circular shapeclipsToBounds = YESdidMoveToWindow(early, prevents flash on push) andlayoutSubviews(handles re-layouts)TypeScript changes
backgroundColor?: ColortoOptionsTopBarButtonDepends on: #8300
Usage
Test plan
backgroundColor: 'yellow'on a top bar button — verify the entire circular platter is filledbackgroundColor— verify no color leaks to other buttonsbackgroundColorremain unaffectedMade with Cursor