Skip native prop metadata for delegate-backed managers (#59296) #59296

Open
javache opened 8:10am on October 21, 2026 wants to merge 407 Ξ” into facebook/react-native main from
export-D126630163
Diff Delta:
407
About 64 Diff Delta/hour
Classified as:  Feature Add

javache's Description of Work

Summary:

Add the default-off skipNativePropsForViewManagerWithDelegateAndroid feature flag. When enabled, ViewManager.getNativeProps() returns an empty map for managers with a non-null, non-generic delegate, avoiding unused manager and shadow-node prop metadata generation. Return a fresh mutable map so subclasses can safely extend super.getNativeProps(). The constants helper already omits NativeProps for an empty map; commands, events and custom constants are preserved.

Null and generic delegates keep the existing metadata path, including its legacy-architecture shadow-node handling. The flag must only be enabled when delegate-backed components use static view configs rather than runtime native prop metadata.

NativeProps queries reuse getOrCreateViewManagerDelegate(), sharing the same delegate with prop updates and commands. Make its lazy initialisation thread-safe with a volatile cache and double-checked synchronisation, leaving warm reads lock-free. Document that initialisation may occur on the JavaScript thread when this flag is enabled.

Regenerate all feature-flag bindings and cover enabled/disabled paths, generic and null delegates, marker-only managers, preserved constants, subclass prop extensions, independent mutable maps, existing-cache reuse and concurrent metadata/command initialisation.

Changelog:
[Android][Changed] - Add an opt-in optimisation to skip native prop metadata for delegate-backed view managers using static view configs.

Differential Revision: D126630163

22 total changed files
Loading changes...
Loading changes...
Loading changes...
Loading changes...
Loading changes...
Loading changes...
Loading changes...
Loading changes...
Loading changes...
Loading changes...
Loading changes...
Loading changes...
Loading changes...
Loading changes...
Loading changes...
Loading changes...
Loading changes...
Loading changes...
Loading changes...
Loading changes...
Loading changes...
You’ve completed the full review pass
Please mind the merge button