Commit 8b19d36
authored
feat: remake first measure logic to not use a static member (#288)
<!-- Thanks for submitting a pull request! We appreciate you spending
the time to work on these changes. Please follow the template so that
the reviewers can easily understand what the code changes affect -->
# 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
| OS | Implemented |
| ------- | :---------: |
| iOS | ✅ |
| Android | ❌ |1 parent 4073a47 commit 8b19d36
2 files changed
Lines changed: 9 additions & 26 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
39 | | - | |
| 38 | + | |
40 | 39 | | |
41 | 40 | | |
42 | 41 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
12 | 11 | | |
13 | 12 | | |
14 | 13 | | |
15 | 14 | | |
16 | 15 | | |
17 | 16 | | |
18 | 17 | | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | 18 | | |
29 | 19 | | |
30 | 20 | | |
31 | | - | |
| 21 | + | |
32 | 22 | | |
33 | 23 | | |
34 | 24 | | |
35 | | - | |
| 25 | + | |
36 | 26 | | |
37 | | - | |
| 27 | + | |
38 | 28 | | |
| 29 | + | |
39 | 30 | | |
40 | 31 | | |
41 | 32 | | |
| |||
65 | 56 | | |
66 | 57 | | |
67 | 58 | | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | 59 | | |
74 | 60 | | |
75 | 61 | | |
| |||
87 | 73 | | |
88 | 74 | | |
89 | 75 | | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | 76 | | |
95 | 77 | | |
96 | 78 | | |
97 | 79 | | |
98 | | - | |
| 80 | + | |
| 81 | + | |
99 | 82 | | |
100 | 83 | | |
101 | | - | |
| 84 | + | |
| 85 | + | |
102 | 86 | | |
103 | 87 | | |
104 | 88 | | |
| |||
0 commit comments