feat: remake first measure logic to not use a static member #288
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
First render (or rather render without an accessible Component View) used a mock component view for measurements as a static member of the Shadow Node. For obvious reasons this won't work with multiple inputs on the same screen.
Original motivation for having mock as a member was to have it created as soon as possible (Shadow Node constructor) to make sure it can be measured on the first render. Turns out it can be very well created just when needed (as long as on main thread) without any first render performance losses.
This PR remakes and simplifies this approach so that we don't need a static member anymore.
Test Plan
Run iOS example app and add a simple state to conditionally render the component. Record its first renders and notice it still properly is rendered with the proper height at once, no stutters or jumps.
Screenshots / Videos
--
Compatibility