Skip to content

Add defaultValue to native view attribute configs - #59890

Open
mrousavy wants to merge 3 commits into
react:mainfrom
mrousavy:feat/attribute-default-value
Open

mrousavy wants to merge 3 commits into
react:mainfrom
mrousavy:feat/attribute-default-value

Conversation

@mrousavy

@mrousavy mrousavy commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Summary:

Add per-attribute defaultValue payloads for props omitted or explicitly undefined on initial creation. For example, {defaultValue: 13, resetValue: undefined} sends 13 on mount and undefined when a previously supplied prop is removed. Explicit null keeps its normal meaning.

Defaults are final payloads and bypass process. They support nested/flattened attributes and are cached per immutable view config. Updates, setNativeProps, and Fabric visibility changes do not reapply them. Existing configurations keep their behavior; opaque values require a component whose transport accepts them.

Part of #59884, stacked on #59889. Incremental diff. Includes the regenerated development, production, and profiling Fabric bundles for react#38171, which marks visibility payloads as updates. Existing Codegen and native defaults stay in place.

Changelog:

[GENERAL][ADDED] - Add defaultValue to native view attribute configurations for initial omitted or undefined props.

Test Plan:

  • Built Hermes and Fantom from source. yarn fantom 'ReactNativeAttributePayload|ReactNativeElement|/View-itest' --runInBand: 514 passed, 2 existing skips. The payload suite runs against development and production JavaScript, including native mount, update, removal, imperative updates, and hide/show behavior.
  • Ran the same suites with ASan and UBSan: 514 passed with no sanitizer errors.
  • The prerequisite's renderer-core C++ suite passed all 99 tests.
  • yarn flow status --show-all-errors, yarn build-types, and yarn test-generated-typescript passed. ESLint and Prettier passed for changed source files.
  • Built all three Fabric bundles from RN's React revision dc9aed364252a34966f4f2c4a98272317fdddb60 plus the companion patch. The unmodified baseline bodies match RN's existing bundles exactly.
  • Companion React Fabric tests passed in source development/production and both WWW channels with both variants. Added a regression test for visibility payload options.

@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 Nov 9, 2026
@github-actions

github-actions Bot commented Nov 9, 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

@facebook-github-tools facebook-github-tools Bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Nov 9, 2026

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. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant