Skip to content

fix(ios): add Auto Layout constraints to RNNReactButtonView#8299

Open
IsaacIsrael wants to merge 1 commit into
wix:masterfrom
IsaacIsrael:fix/button-view-auto-layout
Open

fix(ios): add Auto Layout constraints to RNNReactButtonView#8299
IsaacIsrael wants to merge 1 commit into
wix:masterfrom
IsaacIsrael:fix/button-view-auto-layout

Conversation

@IsaacIsrael
Copy link
Copy Markdown
Contributor

Problem

On iOS 26, the Liquid Glass navigation bar wraps UIBarButtonItem.customView in several internal layout containers (_UITAMICAdaptorView, _TtCC5UIKit19NavigationButtonBar15ItemWrapperView, etc.). Without explicit size constraints, these wrappers can collapse to zero height after a pop → tab-switch → tab-switch → push cycle, making the React-rendered button disappear.

Solution

  • Set translatesAutoresizingMaskIntoConstraints = NO on RNNReactButtonView
  • Add explicit widthAnchor / heightAnchor constraints at UILayoutPriorityDefaultHigh (750) to avoid conflicts with UIKit's internal constraints
  • Update constraints in didMountComponentsWithRootTag: after sizeToFit to reflect the measured React surface size
  • Import <React/RCTSurface.h> for surface access

Test plan

  • Navigate to a screen with a custom React top bar button (component-based UIBarButtonItem)
  • Pop, switch to another tab, switch to a third tab, then push back to the original screen
  • Verify the button remains visible throughout the cycle
  • Verify no white background bleeds through on the Liquid Glass navigation bar

Made with Cursor

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>
@IsaacIsrael IsaacIsrael force-pushed the fix/button-view-auto-layout branch from d969c88 to fd43bcc Compare May 13, 2026 16:09
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.

1 participant