android: stabilize custom top bar button layout#8326
Merged
Conversation
8e7e2fd to
15e8032
Compare
baeb5a9 to
cdab8da
Compare
cdab8da to
26e2471
Compare
israelko
added a commit
that referenced
this pull request
Jun 11, 2026
…e bounded measure Custom React-component top bar buttons without explicit width/height collapsed to ~1px (invisible) under the New Architecture (Fabric). The two-pass measurement from #8320/#8326 re-measured the hosted ReactSurfaceView with an EXACTLY box derived from the first (often still-empty) discovery pass; that forced box is pushed to Fabric via updateLayoutSpecs, so Fabric keeps laying the content out into the collapsed box and the button never recovers. The same forcing also stretched flex-content buttons to the full bar height. Replace the two-pass with a single bounded (AT_MOST) measure and let ReactSurfaceView size itself to its content (its documented AT_MOST max-of-children behavior). When Fabric mounts/sizes the content it re-requests layout and this measure runs again against the real content size. Explicit width/height still measure EXACTLY; vertical centering is preserved by the existing CENTER_VERTICAL gravity. Verified on-device (Pixel 7, newArch+Hermes) on RN 0.78.3 and 0.85.2: content-hugging and flex component buttons render correctly; flex buttons are pixel-identical to before. Unit tests updated for the single-pass contract. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.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.
Summary
Validation
git diff --check./gradlew :react-native-navigation:testDebugUnitTest --tests com.reactnativenavigation.views.TitleBarReactButtonViewTest --tests com.reactnativenavigation.views.TitleAndButtonsContainerTest— SUCCESS (37 successes, 0 failures, 0 skipped)Not Run
Risks
Review Context
AT_MOSTwidth to prevent title truncation.Suggested Reviewers
TitleBarReactButtonViewand the new regression tests in android: fix custom top bar button measurement #8320.