Skip to content

feat: proper iOS first renders measurements - #277

Merged
szydlovsky merged 2 commits into
mainfrom
@szydlovsky/ios-first-render-measure
Nov 24, 2025
Merged

szydlovsky merged 2 commits into
mainfrom
@szydlovsky/ios-first-render-measure

Conversation

@szydlovsky

Copy link
Copy Markdown
Collaborator

Summary

Fixes #238 on iOS.

First render on iOS was looking pretty choppy because there was no way to measure the component on the very first render, because it's still not defined at that time.
This PR adds a mock text input that gets created as soon as the Shadow Node is created, gets the initial component's props and is used for measurements before the real input is defined. After that the mock gets unmounted (when the real input is finally defined).

Before vs After

Please play the videos at x0.25 speed to notice the choppiness:

Before:

firstRenderBefore.mov

After:

firstRenderAfter.mov

Test Plan

Add a state that toggles input's visibility, with the default visibility at false. Then toggle it and see properly measured component appear with no intermediate states.

Compatibility

OS Implemented
iOS
Android ✅(already done)

@exploIF exploIF left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one question, I see it's currently not an issue (but maybe it's just because of the fact that example app is almost empty, and super fast), shouldn't we somehow explicitly disable emitting events for mocked input or is it redundant?

@szydlovsky

Copy link
Copy Markdown
Collaborator Author

@exploIF oh definitely. Will add it

@exploIF
exploIF self-requested a review November 24, 2025 10:33
@szydlovsky
szydlovsky merged commit c560531 into main Nov 24, 2025
5 checks passed
@szydlovsky
szydlovsky deleted the @szydlovsky/ios-first-render-measure branch November 24, 2025 13:17
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.

BUG: initial layout delay

2 participants