Repository navigation
Commit 520938e
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`. The public JS API change is additive: `NativeComponentOptions` gains the optional `generateOptionalProperties` and `generateOptionalObjectProperties` fields, so the API snapshot reports `codegenNativeComponent` as changed without breaking existing callers.
Changelog: [General][Fixed] - Fix `VirtualView` initial mode when `initialHidden` is not sent on creation
Reviewed By: javache
Differential Revision: D123029234initialHidden as an optional prop for VirtualView (#58864)1 parent a4c421a commit 520938e
14 files changed
Lines changed: 23 additions & 17 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 | | |
| |||
6580 | 6580 | | |
6581 | 6581 | | |
6582 | 6582 | | |
6583 | | - | |
6584 | | - | |
| 6583 | + | |
| 6584 | + | |
6585 | 6585 | | |
6586 | 6586 | | |
6587 | 6587 | | |
| |||
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 | | |
| |||
3072 | 3072 | | |
3073 | 3073 | | |
3074 | 3074 | | |
| 3075 | + | |
| 3076 | + | |
3075 | 3077 | | |
3076 | 3078 | | |
3077 | 3079 | | |
| |||
6055 | 6057 | | |
6056 | 6058 | | |
6057 | 6059 | | |
6058 | | - | |
| 6060 | + | |
6059 | 6061 | | |
6060 | 6062 | | |
6061 | 6063 | | |
| |||
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 | |
|---|---|---|---|
| |||
2575 | 2575 | | |
2576 | 2576 | | |
2577 | 2577 | | |
2578 | | - | |
2579 | 2578 | | |
2580 | 2579 | | |
| 2580 | + | |
2581 | 2581 | | |
2582 | 2582 | | |
2583 | 2583 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4415 | 4415 | | |
4416 | 4416 | | |
4417 | 4417 | | |
4418 | | - | |
4419 | 4418 | | |
4420 | 4419 | | |
| 4420 | + | |
4421 | 4421 | | |
4422 | 4422 | | |
4423 | 4423 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2568 | 2568 | | |
2569 | 2569 | | |
2570 | 2570 | | |
2571 | | - | |
2572 | 2571 | | |
2573 | 2572 | | |
| 2573 | + | |
2574 | 2574 | | |
2575 | 2575 | | |
2576 | 2576 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2568 | 2568 | | |
2569 | 2569 | | |
2570 | 2570 | | |
2571 | | - | |
2572 | 2571 | | |
2573 | 2572 | | |
| 2573 | + | |
2574 | 2574 | | |
2575 | 2575 | | |
2576 | 2576 | | |
| |||
0 commit comments