Repository navigation
Investigate childCount > 0 as readiness indicator for screenshot - #111
Merged
Merged
Conversation
…ess indicator Explores using childCount > 0 as the signal that Fabric has mounted children, followed by a re-layout pass before snapping the screenshot. Also investigates OnPreDrawListener as an alternative, which does not work with WindowAttachment.dispatchAttach (no real draw pipeline). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2 tasks
tdrhq
approved these changes
Apr 9, 2026
| detacher = WindowAttachment.dispatchAttach(view) | ||
| app.reactHost.onHostResume(null) | ||
| ViewHelpers.setupView(view).setExactWidthPx(1080).setExactHeightPx(1920).layout() | ||
| surface.start() |
Contributor
There was a problem hiding this comment.
add an assertion here to demonstrate that childCount == 0. In your next PR, try to create a unit test that just gets childCount > 0. Not a screenshot test.
EmilioBejasa
marked this pull request as ready for review
April 9, 2026 19:58
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
childCountTestto verify that Fabric mounts children into the surface view when usingWindowAttachment.dispatchAttach+onHostResume+surface.start()childCountScreenshotTestto verify that polling untilchildCount > 0, then re-running layout, produces a non-blank screenshotOnPreDrawListeneras an alternative readiness signal — ruled out because it requires a real draw pipeline, whichWindowAttachment.dispatchAttachdoes not provideWhy
Before building a reusable screenshot testing library, we need a reliable indicator that a React Native view is ready to be snapshotted. This PR establishes that
childCount > 0(Fabric has mounted children) followed by a re-layout pass is a viable signal.Test plan
childCountTestpasses — confirms readiness signal is reachablechildCountScreenshotTestpasses — confirms signal produces a non-blank screenshot ("Hello" visible in top-left)🤖 Generated with Claude Code