Skip to content

Generate initialHidden as an optional prop for VirtualView (#58864) - #58864

Open
bartlomiejbloniarz wants to merge 1 commit into
mainfrom
export-D123029234
Open

bartlomiejbloniarz wants to merge 1 commit into
mainfrom
export-D123029234

Conversation

@bartlomiejbloniarz

@bartlomiejbloniarz bartlomiejbloniarz commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

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: D123029234

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 5, 2026
@facebook-github-tools facebook-github-tools Bot added p: Software Mansion Partner: Software Mansion Partner p: Facebook Partner: Facebook labels Oct 5, 2026
@bartlomiejbloniarz bartlomiejbloniarz added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. p: Facebook Partner: Facebook Partner p: Software Mansion Partner: Software Mansion labels Oct 5, 2026
@meta-codesync

meta-codesync Bot commented Oct 5, 2026

Copy link
Copy Markdown

@bartlomiejbloniarz has exported this pull request. If you are a Meta employee, you can view the originating Diff in D123029234.

@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown

Warning

JavaScript API change detected

This PR commits an update to ReactNativeApi.d.ts, indicating a change to React Native's public JavaScript API.

  • Please include a clear changelog message.
  • This change will be subject to additional review.

This change was flagged as: POTENTIALLY_BREAKING

@meta-codesync meta-codesync Bot changed the title Generate initialHidden as an optional prop for VirtualView Generate initialHidden as an optional prop for VirtualView (#58864) Oct 6, 2026
meta-codesync Bot pushed a commit that referenced this pull request Oct 6, 2026
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

Differential Revision: D123029234
@meta-codesync
meta-codesync Bot force-pushed the export-D123029234 branch from 2d985f1 to e0f1454 Compare October 6, 2026 12:54
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: D123029234
@meta-codesync
meta-codesync Bot force-pushed the export-D123029234 branch from e0f1454 to 520938e Compare October 8, 2026 14:50

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. meta-exported p: Facebook Partner: Facebook p: Software Mansion Partner: Software Mansion Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant