Deprecate legacy UIBlock and addUIBlock/prependUIBlock APIs

Summary:
Deprecate `UIBlock`, `NativeViewHierarchyManager`, and the `addUIBlock`/`prependUIBlock` methods on `UIManagerModule`. These are legacy Paper architecture APIs that are already non-functional stubs. Libraries should migrate to `UIManagerListener` or View Commands.

The Fabric replacement for `UIBlock` already exists at `com.facebook.react.fabric.interop.UIBlock` and uses `UIBlockViewResolver` instead of `NativeViewHierarchyManager`.

Changelog:
[Android][Deprecated] - Deprecate `UIBlock` interface and `UIManagerModule.addUIBlock`/`prependUIBlock` methods. Use `UIManagerListener` or View Commands instead.

Reviewed By: javache

Differential Revision: D104995161

fbshipit-source-id: 447067129765761a587a8fc5a1b57710b29a1132
This commit is contained in:
Nicola Corti authored and meta-codesync[bot] committed 2026-05-15 06:36:46 -07:00
1 parent 2f1d1e3de3
commit 29a76918a9
2 files changed
+15 -6

No files matched your search

@@ -7,7 +7,13 @@
package com.facebook.react.uimanager
/** A task to execute on the UI View for third party libraries. */
/**
* A task to execute on the UI View for third party libraries.
*
* @deprecated This interface is part of the Legacy Architecture and will be removed in a future
* release. Use [com.facebook.react.bridge.UIManagerListener] or View Commands instead.
*/
@Deprecated("Use UIManagerListener or View Commands instead")
public fun interface UIBlock {
public fun execute(
@Suppress("DEPRECATION") nativeViewHierarchyManager: NativeViewHierarchyManager
@@ -568,12 +568,11 @@ public class UIManagerModule extends ReactContextBaseJavaModule
* after all currently queued view updates have completed.
*
* @param block that contains UI logic you want to execute.
* <p>Usage Example:
* <p>UIManagerModule uiManager = reactContext.getNativeModule(UIManagerModule.class);
* uiManager.addUIBlock(new UIBlock() { public void execute (NativeViewHierarchyManager nvhm)
* { View view = nvhm.resolveView(tag); // ...execute your code on View (e.g. snapshot the
* view) } });
* @deprecated This method is a no-op stub retained for backward compatibility. Use {@link
* UIManagerListener} or View Commands instead.
*/
@Deprecated
@SuppressWarnings("deprecation")
public void addUIBlock(UIBlock block) {}
/**
@@ -581,7 +580,11 @@ public class UIManagerModule extends ReactContextBaseJavaModule
* before all currently queued view updates have completed.
*
* @param block that contains UI logic you want to execute.
* @deprecated This method is a no-op stub retained for backward compatibility. Use {@link
* UIManagerListener} or View Commands instead.
*/
@Deprecated
@SuppressWarnings("deprecation")
public void prependUIBlock(UIBlock block) {}
@Override