Repository navigation
Commit 2d985f1
Generate
Summary:
`VirtualViewNativeComponent` declared `initialHidden?: boolean`, which codegen generated as a plain `bool` defaulting to `false`. On Android, props equal to their C++ default are not sent when a view is created, so an explicit `initialHidden={false}` never reached `ReactVirtualViewManager.setInitialHidden`. The view's `mode` stayed `null`, so it emitted a synchronous `Visible` mode change on its first update, emitted a normally suppressed `Prerender` change, and skipped the clipping update when it first left `Visible`.
Declare the prop as `WithDefault<boolean, null>` and opt the spec into `generateOptionalProperties`, so `initialHidden` is a `std::optional<bool>` that is unset by default and an explicit `false` is sent. A plain `?: boolean` is not enough, because the Flow parser assigns it a `false` default. The `codegenNativeComponent` Flow options type gains the codegen options already declared in its TypeScript types, and iOS reads the prop with `value_or(false)`.
This changes generated APIs of VirtualView: `VirtualViewProps::initialHidden` becomes `std::optional<bool>`, and `VirtualViewManagerInterface.setInitialHidden` takes a nullable `Boolean`.
Changelog: [General][Fixed] - Fix `VirtualView` initial mode when `initialHidden` is not sent on creation
Differential Revision: D123029234initialHidden as an optional prop for VirtualView1 parent 52efed6 commit 2d985f1
12 files changed
Lines changed: 21 additions & 15 deletions
File tree
- packages/react-native
- Libraries/Utilities
- ReactAndroid
- api
- src/main/java/com/facebook/react/views/virtual/view
- React/Fabric/Mounting/ComponentViews/VirtualView
- src/private/components/virtualview
- scripts/cxx-api/api-snapshots
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
| 25 | + | |
24 | 26 | | |
25 | 27 | | |
26 | 28 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
66 | | - | |
| 66 | + | |
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5152 | 5152 | | |
5153 | 5153 | | |
5154 | 5154 | | |
5155 | | - | |
| 5155 | + | |
5156 | 5156 | | |
5157 | 5157 | | |
5158 | 5158 | | |
| |||
6579 | 6579 | | |
6580 | 6580 | | |
6581 | 6581 | | |
6582 | | - | |
6583 | | - | |
| 6582 | + | |
| 6583 | + | |
6584 | 6584 | | |
6585 | 6585 | | |
6586 | 6586 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
| 40 | + | |
41 | 41 | | |
42 | | - | |
| 42 | + | |
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
3076 | 3076 | | |
3077 | 3077 | | |
3078 | 3078 | | |
| 3079 | + | |
| 3080 | + | |
3079 | 3081 | | |
3080 | 3082 | | |
3081 | 3083 | | |
| |||
6058 | 6060 | | |
6059 | 6061 | | |
6060 | 6062 | | |
6061 | | - | |
| 6063 | + | |
6062 | 6064 | | |
6063 | 6065 | | |
6064 | 6066 | | |
| |||
Lines changed: 3 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| |||
65 | 66 | | |
66 | 67 | | |
67 | 68 | | |
68 | | - | |
| 69 | + | |
69 | 70 | | |
70 | 71 | | |
71 | 72 | | |
| |||
93 | 94 | | |
94 | 95 | | |
95 | 96 | | |
| 97 | + | |
96 | 98 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5570 | 5570 | | |
5571 | 5571 | | |
5572 | 5572 | | |
5573 | | - | |
5574 | 5573 | | |
5575 | 5574 | | |
| 5575 | + | |
5576 | 5576 | | |
5577 | 5577 | | |
5578 | 5578 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5380 | 5380 | | |
5381 | 5381 | | |
5382 | 5382 | | |
5383 | | - | |
5384 | 5383 | | |
5385 | 5384 | | |
| 5385 | + | |
5386 | 5386 | | |
5387 | 5387 | | |
5388 | 5388 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5561 | 5561 | | |
5562 | 5562 | | |
5563 | 5563 | | |
5564 | | - | |
5565 | 5564 | | |
5566 | 5565 | | |
| 5566 | + | |
5567 | 5567 | | |
5568 | 5568 | | |
5569 | 5569 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7701 | 7701 | | |
7702 | 7702 | | |
7703 | 7703 | | |
7704 | | - | |
7705 | 7704 | | |
7706 | 7705 | | |
| 7706 | + | |
7707 | 7707 | | |
7708 | 7708 | | |
7709 | 7709 | | |
| |||
0 commit comments