Skip to content

Commit 29a7691

Browse files
cortinicometa-codesync[bot]
authored andcommitted
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
1 parent 2f1d1e3 commit 29a7691

2 files changed

Lines changed: 15 additions & 6 deletions

File tree

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIBlock.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,13 @@
77

88
package com.facebook.react.uimanager
99

10-
/** A task to execute on the UI View for third party libraries. */
10+
/**
11+
* A task to execute on the UI View for third party libraries.
12+
*
13+
* @deprecated This interface is part of the Legacy Architecture and will be removed in a future
14+
* release. Use [com.facebook.react.bridge.UIManagerListener] or View Commands instead.
15+
*/
16+
@Deprecated("Use UIManagerListener or View Commands instead")
1117
public fun interface UIBlock {
1218
public fun execute(
1319
@Suppress("DEPRECATION") nativeViewHierarchyManager: NativeViewHierarchyManager

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModule.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -568,20 +568,23 @@ public void sendAccessibilityEvent(int tag, int eventType) {
568568
* after all currently queued view updates have completed.
569569
*
570570
* @param block that contains UI logic you want to execute.
571-
* <p>Usage Example:
572-
* <p>UIManagerModule uiManager = reactContext.getNativeModule(UIManagerModule.class);
573-
* uiManager.addUIBlock(new UIBlock() { public void execute (NativeViewHierarchyManager nvhm)
574-
* { View view = nvhm.resolveView(tag); // ...execute your code on View (e.g. snapshot the
575-
* view) } });
571+
* @deprecated This method is a no-op stub retained for backward compatibility. Use {@link
572+
* UIManagerListener} or View Commands instead.
576573
*/
574+
@Deprecated
575+
@SuppressWarnings("deprecation")
577576
public void addUIBlock(UIBlock block) {}
578577

579578
/**
580579
* Schedule a block to be executed on the UI thread. Useful if you need to execute view logic
581580
* before all currently queued view updates have completed.
582581
*
583582
* @param block that contains UI logic you want to execute.
583+
* @deprecated This method is a no-op stub retained for backward compatibility. Use {@link
584+
* UIManagerListener} or View Commands instead.
584585
*/
586+
@Deprecated
587+
@SuppressWarnings("deprecation")
585588
public void prependUIBlock(UIBlock block) {}
586589

587590
@Override

0 commit comments

Comments
 (0)