fix(android): embedded surface renders with zero height on RN 0.85#38
Open
akelmanson wants to merge 1 commit into
Open
fix(android): embedded surface renders with zero height on RN 0.85#38akelmanson wants to merge 1 commit into
akelmanson wants to merge 1 commit into
Conversation
On RN 0.85 the embedded sandbox surface stays blank: the component runs
("Running <name>") but the native SandboxReactNativeView is laid out with
height 0. Two causes, both fixed here:
1. The native view is wrapped as position:absolute (StyleSheet.absoluteFillObject)
inside the user-styled <View>. On 0.85 an absolutely-positioned child with
all-zero insets no longer stretches to a flex-sized parent and collapses to
height 0 (width still comes from the parent's default alignItems:stretch,
masking it). Make the in-flow child flex:1 so it reliably claims the
wrapper's space.
2. onLayout positioned the nested ReactSurfaceView via layout() but never
measured it. ReactSurfaceView only pushes layout constraints to its surface
from onMeasure() (its onLayout() is a no-op until wasMeasured). Measure the
child with EXACTLY specs so updateLayoutSpecs() runs with the real size.
Verified on a device (RN 0.85.3): the embedded surface renders and lays out.
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
On RN 0.85 the embedded sandbox surface stays blank on Android: the bundle runs (
Running "<name>"shows in the log) but the nativeSandboxReactNativeViewis laid out with height 0 (width still fills via the parent's defaultalignItems: stretch, which masks the problem). The lib works on RN 0.80 — this is a 0.85 regression.Two independent causes, both fixed:
absoluteFillObjectcollapses to height 0. The native view is rendered asposition:absolute(StyleSheet.absoluteFillObject) inside the user-styled<View>wrapper. On RN 0.85 an absolutely-positioned child with all-zero insets (top/left/right/bottom: 0) no longer stretches to a flex-sized parent — it collapses to height 0. Making it an in-flowflex: 1child makes it reliably claim the wrapper's space.Nested
ReactSurfaceViewnever measured.onLayoutpositioned the child withlayout()but never calledmeasure().ReactSurfaceViewonly pushes layout constraints to its surface fromonMeasure()(itsonLayout()is a no-op untilwasMeasuredis true), so the nested surface kept its initial constructor constraints and rendered blank. We nowmeasure()the child withEXACTLYspecs before laying it out, soupdateLayoutSpecs()runs with the real size.Test plan
Verified on a device (RN 0.85.3 / React 19.2.3, New Architecture, Android/Waydroid x86_64): the embedded surface renders, lays out to fill its container, and receives touches. Before the change
onLayoutreportedw=742 h=0; after,w=742 h=919and the surface paints.🤖 Generated with Claude Code