diff --git a/packages/react-native/Libraries/ReactNative/BridgelessUIManager.js b/packages/react-native/Libraries/ReactNative/BridgelessUIManager.js index 41e0e2bb57bd..adcdf0f3cbc7 100644 --- a/packages/react-native/Libraries/ReactNative/BridgelessUIManager.js +++ b/packages/react-native/Libraries/ReactNative/BridgelessUIManager.js @@ -160,27 +160,7 @@ const UIManagerJSUnusedInNewArchAPIs = { * them from React Native. */ const UIManagerJSDeprecatedPlatformAPIs = Platform.select({ - android: { - // TODO(T175424986): Remove UIManager.showPopupMenu() in React Native v0.75. - showPopupMenu: ( - reactTag: number, - items: Array, - error: (error: Object) => void, - success: (event: string, selected?: number) => void, - ): void => { - raiseSoftError( - 'showPopupMenu', - 'Please use the component instead.', - ); - }, - // TODO(T175424986): Remove UIManager.dismissPopupMenu() in React Native v0.75. - dismissPopupMenu: (): void => { - raiseSoftError( - 'dismissPopupMenu', - 'Please use the component instead.', - ); - }, - }, + android: {}, }); const UIManagerJSPlatformAPIs = Platform.select({ diff --git a/packages/react-native/Libraries/ReactNative/UIManagerProperties.js b/packages/react-native/Libraries/ReactNative/UIManagerProperties.js index 9ea41bc12d18..995441006fc8 100644 --- a/packages/react-native/Libraries/ReactNative/UIManagerProperties.js +++ b/packages/react-native/Libraries/ReactNative/UIManagerProperties.js @@ -30,7 +30,6 @@ module.exports = [ 'clearJSResponder', 'configureNextLayoutAnimation', 'createView', - 'dismissPopupMenu', 'dispatchViewManagerCommand', 'findSubviewIn', 'getConstantsForViewManager', @@ -45,10 +44,8 @@ module.exports = [ 'setChildren', 'setJSResponder', 'setLayoutAnimationEnabledExperimental', - 'showPopupMenu', 'updateView', 'viewIsDescendantOf', - 'PopupMenu', 'LazyViewManagersEnabled', 'ViewManagerNames', 'StyleConstants', diff --git a/packages/react-native/ReactAndroid/api/ReactAndroid.api b/packages/react-native/ReactAndroid/api/ReactAndroid.api index d787e503df26..969ae04cdf83 100644 --- a/packages/react-native/ReactAndroid/api/ReactAndroid.api +++ b/packages/react-native/ReactAndroid/api/ReactAndroid.api @@ -4220,7 +4220,6 @@ public class com/facebook/react/uimanager/NativeViewHierarchyManager { protected final fun addRootViewGroup (ILandroid/view/View;)V public fun clearJSResponder ()V public fun createView (Lcom/facebook/react/uimanager/ThemedReactContext;ILjava/lang/String;Lcom/facebook/react/uimanager/ReactStylesDiffMap;)V - public fun dismissPopupMenu ()V public fun dispatchCommand (IILcom/facebook/react/bridge/ReadableArray;)V public fun dispatchCommand (ILjava/lang/String;Lcom/facebook/react/bridge/ReadableArray;)V protected fun dropView (Landroid/view/View;)V @@ -4237,7 +4236,6 @@ public class com/facebook/react/uimanager/NativeViewHierarchyManager { public fun setChildren (ILcom/facebook/react/bridge/ReadableArray;)V public fun setJSResponder (IIZ)V public fun setLayoutAnimationEnabled (Z)V - public fun showPopupMenu (ILcom/facebook/react/bridge/ReadableArray;Lcom/facebook/react/bridge/Callback;Lcom/facebook/react/bridge/Callback;)V public fun updateInstanceHandle (IJ)V public fun updateLayout (IIIIII)V public fun updateProperties (ILcom/facebook/react/uimanager/ReactStylesDiffMap;)V @@ -4946,7 +4944,6 @@ public class com/facebook/react/uimanager/UIImplementation { protected fun createRootShadowNode ()Lcom/facebook/react/uimanager/ReactShadowNode; protected fun createShadowNode (Ljava/lang/String;)Lcom/facebook/react/uimanager/ReactShadowNode; public fun createView (ILjava/lang/String;ILcom/facebook/react/bridge/ReadableMap;)V - public fun dismissPopupMenu ()V public fun dispatchViewManagerCommand (IILcom/facebook/react/bridge/ReadableArray;)V public fun dispatchViewManagerCommand (ILjava/lang/String;Lcom/facebook/react/bridge/ReadableArray;)V public fun dispatchViewUpdates (I)V @@ -4982,7 +4979,6 @@ public class com/facebook/react/uimanager/UIImplementation { public fun setLayoutUpdateListener (Lcom/facebook/react/uimanager/UIImplementation$LayoutUpdateListener;)V public fun setViewHierarchyUpdateDebugListener (Lcom/facebook/react/uimanager/debug/NotThreadSafeViewHierarchyUpdateDebugListener;)V public fun setViewLocalData (ILjava/lang/Object;)V - public fun showPopupMenu (ILcom/facebook/react/bridge/ReadableArray;Lcom/facebook/react/bridge/Callback;Lcom/facebook/react/bridge/Callback;)V public fun synchronouslyUpdateViewOnUIThread (ILcom/facebook/react/uimanager/ReactStylesDiffMap;)V public fun updateNodeSize (III)V public fun updateRootView (III)V @@ -5026,7 +5022,6 @@ public class com/facebook/react/uimanager/UIManagerModule : com/facebook/react/b public fun configureNextLayoutAnimation (Lcom/facebook/react/bridge/ReadableMap;Lcom/facebook/react/bridge/Callback;Lcom/facebook/react/bridge/Callback;)V public static fun createConstants (Ljava/util/List;Ljava/util/Map;Ljava/util/Map;)Ljava/util/Map; public fun createView (ILjava/lang/String;ILcom/facebook/react/bridge/ReadableMap;)V - public fun dismissPopupMenu ()V public fun dispatchCommand (IILcom/facebook/react/bridge/ReadableArray;)V public fun dispatchCommand (ILjava/lang/String;Lcom/facebook/react/bridge/ReadableArray;)V public fun dispatchViewManagerCommand (ILcom/facebook/react/bridge/Dynamic;Lcom/facebook/react/bridge/ReadableArray;)V @@ -5070,7 +5065,6 @@ public class com/facebook/react/uimanager/UIManagerModule : com/facebook/react/b public fun setLayoutAnimationEnabledExperimental (Z)V public fun setViewHierarchyUpdateDebugListener (Lcom/facebook/react/uimanager/debug/NotThreadSafeViewHierarchyUpdateDebugListener;)V public fun setViewLocalData (ILjava/lang/Object;)V - public fun showPopupMenu (ILcom/facebook/react/bridge/ReadableArray;Lcom/facebook/react/bridge/Callback;Lcom/facebook/react/bridge/Callback;)V public fun startSurface (Landroid/view/View;Ljava/lang/String;Lcom/facebook/react/bridge/WritableMap;II)I public fun stopSurface (I)V public fun synchronouslyUpdateViewOnUIThread (ILcom/facebook/react/bridge/ReadableMap;)V @@ -5101,7 +5095,6 @@ public class com/facebook/react/uimanager/UIViewOperationQueue { public fun enqueueClearJSResponder ()V public fun enqueueConfigureLayoutAnimation (Lcom/facebook/react/bridge/ReadableMap;Lcom/facebook/react/bridge/Callback;)V public fun enqueueCreateView (Lcom/facebook/react/uimanager/ThemedReactContext;ILjava/lang/String;Lcom/facebook/react/uimanager/ReactStylesDiffMap;)V - public fun enqueueDismissPopupMenu ()V public fun enqueueDispatchCommand (IILcom/facebook/react/bridge/ReadableArray;)V public fun enqueueDispatchCommand (ILjava/lang/String;Lcom/facebook/react/bridge/ReadableArray;)V public fun enqueueFindTargetForTouch (IFFLcom/facebook/react/bridge/Callback;)V @@ -5114,7 +5107,6 @@ public class com/facebook/react/uimanager/UIViewOperationQueue { public fun enqueueSetChildren (ILcom/facebook/react/bridge/ReadableArray;)V public fun enqueueSetJSResponder (IIZ)V public fun enqueueSetLayoutAnimationEnabled (Z)V - public fun enqueueShowPopupMenu (ILcom/facebook/react/bridge/ReadableArray;Lcom/facebook/react/bridge/Callback;Lcom/facebook/react/bridge/Callback;)V public fun enqueueUIBlock (Lcom/facebook/react/uimanager/UIBlock;)V protected fun enqueueUIOperation (Lcom/facebook/react/uimanager/UIViewOperationQueue$UIOperation;)V public fun enqueueUpdateExtraData (ILjava/lang/Object;)V diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/NativeViewHierarchyManager.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/NativeViewHierarchyManager.java index 7bc971fd73e0..d2ef20074c2a 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/NativeViewHierarchyManager.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/NativeViewHierarchyManager.java @@ -12,12 +12,9 @@ import android.graphics.RectF; import android.util.SparseArray; import android.util.SparseBooleanArray; -import android.view.Menu; -import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.view.ViewParent; -import android.widget.PopupMenu; import androidx.annotation.Nullable; import com.facebook.common.logging.FLog; import com.facebook.react.R; @@ -81,7 +78,6 @@ public class NativeViewHierarchyManager { private final RectF mBoundingBox = new RectF(); private boolean mLayoutAnimationEnabled; - private PopupMenu mPopupMenu; private HashMap> mPendingDeletionsForTag; public NativeViewHierarchyManager(ViewManagerRegistry viewManagers) { @@ -862,85 +858,6 @@ public synchronized void dispatchCommand( viewManager.receiveCommand(view, commandId, args); } - /** - * Show a {@link PopupMenu}. - * - *

This is deprecated, please use the component instead. - * - *

TODO(T175424986): Remove UIManager.showPopupMenu() in React Native v0.75. - * - * @param reactTag the tag of the anchor view (the PopupMenu is displayed next to this view); this - * needs to be the tag of a native view (shadow views can not be anchors) - * @param items the menu items as an array of strings - * @param success will be called with the position of the selected item as the first argument, or - * no arguments if the menu is dismissed - */ - @Deprecated - public synchronized void showPopupMenu( - int reactTag, ReadableArray items, Callback success, Callback error) { - UiThreadUtil.assertOnUiThread(); - View anchor = mTagsToViews.get(reactTag); - if (anchor == null) { - error.invoke("Can't display popup. Could not find view with tag " + reactTag); - return; - } - mPopupMenu = new PopupMenu(getReactContextForView(reactTag), anchor); - - Menu menu = mPopupMenu.getMenu(); - for (int i = 0; i < items.size(); i++) { - menu.add(Menu.NONE, Menu.NONE, i, items.getString(i)); - } - - PopupMenuCallbackHandler handler = new PopupMenuCallbackHandler(success); - mPopupMenu.setOnMenuItemClickListener(handler); - mPopupMenu.setOnDismissListener(handler); - - mPopupMenu.show(); - } - - /** - * This is deprecated, please use the component instead. - * - *

TODO(T175424986): Remove UIManager.dismissPopupMenu() in React Native v0.75. - * - *

Dismiss the last opened PopupMenu {@link PopupMenu}. - */ - @Deprecated - public void dismissPopupMenu() { - if (mPopupMenu != null) { - mPopupMenu.dismiss(); - } - } - - private static class PopupMenuCallbackHandler - implements PopupMenu.OnMenuItemClickListener, PopupMenu.OnDismissListener { - - final Callback mSuccess; - boolean mConsumed = false; - - private PopupMenuCallbackHandler(Callback success) { - mSuccess = success; - } - - @Override - public void onDismiss(PopupMenu menu) { - if (!mConsumed) { - mSuccess.invoke(UIManagerModuleConstants.ACTION_DISMISSED); - mConsumed = true; - } - } - - @Override - public boolean onMenuItemClick(MenuItem item) { - if (!mConsumed) { - mSuccess.invoke(UIManagerModuleConstants.ACTION_ITEM_SELECTED, item.getOrder()); - mConsumed = true; - return true; - } - return false; - } - } - /** * @return Themed React context for view with a given {@param reactTag} - it gets the context * directly from the view using {@link View#getContext}. diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIImplementation.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIImplementation.java index 6b3ac1afd410..c8959a4c1fe1 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIImplementation.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIImplementation.java @@ -741,36 +741,6 @@ public void dispatchViewManagerCommand( mOperationsQueue.enqueueDispatchCommand(reactTag, commandId, commandArgs); } - /** - * Show a PopupMenu. - * - *

This is deprecated, please use the component instead. - * - *

TODO(T175424986): Remove UIManager.showPopupMenu() in React Native v0.75. - * - * @param reactTag the tag of the anchor view (the PopupMenu is displayed next to this view); this - * needs to be the tag of a native view (shadow views can not be anchors) - * @param items the menu items as an array of strings - * @param error will be called if there is an error displaying the menu - * @param success will be called with the position of the selected item as the first argument, or - * no arguments if the menu is dismissed - */ - @Deprecated - public void showPopupMenu(int reactTag, ReadableArray items, Callback error, Callback success) { - boolean viewExists = checkOrAssertViewExists(reactTag, "showPopupMenu"); - if (!viewExists) { - return; - } - - mOperationsQueue.enqueueShowPopupMenu(reactTag, items, error, success); - } - - /** TODO(T175424986): Remove UIManager.dismissPopupMenu() in React Native v0.75. */ - @Deprecated - public void dismissPopupMenu() { - mOperationsQueue.enqueueDismissPopupMenu(); - } - public void sendAccessibilityEvent(int tag, int eventType) { mOperationsQueue.enqueueSendAccessibilityEvent(tag, eventType); } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModule.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModule.java index dca4fcf5b130..42b420d0f829 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModule.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModule.java @@ -615,37 +615,6 @@ public void dispatchCommand(int reactTag, String commandId, @Nullable ReadableAr mUIImplementation.dispatchViewManagerCommand(reactTag, commandId, commandArgs); } - /** - * Show a PopupMenu. - * - *

This is deprecated, please use the component instead. - * - *

TODO(T175424986): Remove UIManager.showPopupMenu() in React Native v0.75. - * - * @param reactTag the tag of the anchor view (the PopupMenu is displayed next to this view); this - * needs to be the tag of a native view (shadow views can not be anchors) - * @param items the menu items as an array of strings - * @param error will be called if there is an error displaying the menu - * @param success will be called with the position of the selected item as the first argument, or - * no arguments if the menu is dismissed - */ - @ReactMethod - @Deprecated - public void showPopupMenu(int reactTag, ReadableArray items, Callback error, Callback success) { - mUIImplementation.showPopupMenu(reactTag, items, error, success); - } - - /** - * This is deprecated, please use the component instead. - * - *

TODO(T175424986): Remove UIManager.dismissPopupMenu() in React Native v0.75. - */ - @ReactMethod - @Deprecated - public void dismissPopupMenu() { - mUIImplementation.dismissPopupMenu(); - } - /** * LayoutAnimation API on Android is currently experimental. Therefore, it needs to be enabled * explicitly in order to avoid regression in existing application written for iOS using this API. diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModuleConstants.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModuleConstants.java index be8c69379f74..43285de39da3 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModuleConstants.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModuleConstants.java @@ -104,11 +104,6 @@ public static Map getConstants() { "unspecified", PointerEvents.AUTO.ordinal()))); - constants.put( - "PopupMenu", - MapBuilder.of( - ACTION_DISMISSED, ACTION_DISMISSED, ACTION_ITEM_SELECTED, ACTION_ITEM_SELECTED)); - constants.put( "AccessibilityEventTypes", MapBuilder.of( diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIViewOperationQueue.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIViewOperationQueue.java index 2acef25ee15c..ad07257fb1bf 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIViewOperationQueue.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIViewOperationQueue.java @@ -343,44 +343,6 @@ public int getRetries() { } } - /** - * This is deprecated, please use the component instead. - * - *

TODO(T175424986): Remove UIManager.showPopupMenu() in React Native v0.75. - */ - @Deprecated - private final class ShowPopupMenuOperation extends ViewOperation { - - private final ReadableArray mItems; - private final Callback mError; - private final Callback mSuccess; - - public ShowPopupMenuOperation(int tag, ReadableArray items, Callback error, Callback success) { - super(tag); - mItems = items; - mError = error; - mSuccess = success; - } - - @Override - public void execute() { - mNativeViewHierarchyManager.showPopupMenu(mTag, mItems, mSuccess, mError); - } - } - - /** - * This is deprecated, please use the component instead. - * - *

TODO(T175424986): Remove UIManager.dismissPopupMenu() in React Native v0.75. - */ - @Deprecated - private final class DismissPopupMenuOperation implements UIOperation { - @Override - public void execute() { - mNativeViewHierarchyManager.dismissPopupMenu(); - } - } - /** A spec for animation operations (add/remove) */ private abstract static class AnimationOperation implements UIViewOperationQueue.UIOperation { @@ -715,27 +677,6 @@ public void enqueueUpdateExtraData(int reactTag, Object extraData) { mOperations.add(new UpdateViewExtraData(reactTag, extraData)); } - /** - * This is deprecated, please use the component instead. - * - *

TODO(T175424986): Remove UIManager.showPopupMenu() in React Native v0.75. - */ - @Deprecated - public void enqueueShowPopupMenu( - int reactTag, ReadableArray items, Callback error, Callback success) { - mOperations.add(new ShowPopupMenuOperation(reactTag, items, error, success)); - } - - /** - * This is deprecated, please use the component instead. - * - *

TODO(T175424986): Remove UIManager.dismissPopupMenu() in React Native v0.75. - */ - @Deprecated - public void enqueueDismissPopupMenu() { - mOperations.add(new DismissPopupMenuOperation()); - } - public void enqueueCreateView( ThemedReactContext themedContext, int viewReactTag, diff --git a/packages/react-native/src/private/specs/modules/NativeUIManager.js b/packages/react-native/src/private/specs/modules/NativeUIManager.js index 3bdb0254a931..c4ae6bb3d8a2 100644 --- a/packages/react-native/src/private/specs/modules/NativeUIManager.js +++ b/packages/react-native/src/private/specs/modules/NativeUIManager.js @@ -101,13 +101,6 @@ export interface Spec extends TurboModule { +getDefaultEventTypes?: () => Array; +setLayoutAnimationEnabledExperimental?: (enabled: boolean) => void; +sendAccessibilityEvent?: (reactTag: number, eventType: number) => void; - +showPopupMenu?: ( - reactTag: number, - items: Array, - error: (error: Object) => void, - success: (event: string, selected?: number) => void, - ) => void; - +dismissPopupMenu?: () => void; // ios only +lazilyLoadView?: (name: string) => Object; // revisit return