Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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<string>,
error: (error: Object) => void,
success: (event: string, selected?: number) => void,
): void => {
raiseSoftError(
'showPopupMenu',
'Please use the <PopupMenuAndroid /> component instead.',
);
},
// TODO(T175424986): Remove UIManager.dismissPopupMenu() in React Native v0.75.
dismissPopupMenu: (): void => {
raiseSoftError(
'dismissPopupMenu',
'Please use the <PopupMenuAndroid /> component instead.',
);
},
},
android: {},
});

const UIManagerJSPlatformAPIs = Platform.select({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ module.exports = [
'clearJSResponder',
'configureNextLayoutAnimation',
'createView',
'dismissPopupMenu',
'dispatchViewManagerCommand',
'findSubviewIn',
'getConstantsForViewManager',
Expand All @@ -45,10 +44,8 @@ module.exports = [
'setChildren',
'setJSResponder',
'setLayoutAnimationEnabledExperimental',
'showPopupMenu',
'updateView',
'viewIsDescendantOf',
'PopupMenu',
'LazyViewManagersEnabled',
'ViewManagerNames',
'StyleConstants',
Expand Down
8 changes: 0 additions & 8 deletions packages/react-native/ReactAndroid/api/ReactAndroid.api
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -81,7 +78,6 @@ public class NativeViewHierarchyManager {
private final RectF mBoundingBox = new RectF();

private boolean mLayoutAnimationEnabled;
private PopupMenu mPopupMenu;
private HashMap<Integer, Set<Integer>> mPendingDeletionsForTag;

public NativeViewHierarchyManager(ViewManagerRegistry viewManagers) {
Expand Down Expand Up @@ -862,85 +858,6 @@ public synchronized void dispatchCommand(
viewManager.receiveCommand(view, commandId, args);
}

/**
* Show a {@link PopupMenu}.
*
* <p>This is deprecated, please use the <PopupMenuAndroid /> component instead.
*
* <p>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 <PopupMenuAndroid /> component instead.
*
* <p>TODO(T175424986): Remove UIManager.dismissPopupMenu() in React Native v0.75.
*
* <p>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}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -741,36 +741,6 @@ public void dispatchViewManagerCommand(
mOperationsQueue.enqueueDispatchCommand(reactTag, commandId, commandArgs);
}

/**
* Show a PopupMenu.
*
* <p>This is deprecated, please use the <PopupMenuAndroid /> component instead.
*
* <p>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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -615,37 +615,6 @@ public void dispatchCommand(int reactTag, String commandId, @Nullable ReadableAr
mUIImplementation.dispatchViewManagerCommand(reactTag, commandId, commandArgs);
}

/**
* Show a PopupMenu.
*
* <p>This is deprecated, please use the <PopupMenuAndroid /> component instead.
*
* <p>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 <PopupMenuAndroid /> component instead.
*
* <p>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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,6 @@ public static Map<String, Object> 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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -343,44 +343,6 @@ public int getRetries() {
}
}

/**
* This is deprecated, please use the <PopupMenuAndroid /> component instead.
*
* <p>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 <PopupMenuAndroid /> component instead.
*
* <p>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 {

Expand Down Expand Up @@ -715,27 +677,6 @@ public void enqueueUpdateExtraData(int reactTag, Object extraData) {
mOperations.add(new UpdateViewExtraData(reactTag, extraData));
}

/**
* This is deprecated, please use the <PopupMenuAndroid /> component instead.
*
* <p>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 <PopupMenuAndroid /> component instead.
*
* <p>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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,6 @@ export interface Spec extends TurboModule {
+getDefaultEventTypes?: () => Array<string>;
+setLayoutAnimationEnabledExperimental?: (enabled: boolean) => void;
+sendAccessibilityEvent?: (reactTag: number, eventType: number) => void;
+showPopupMenu?: (
reactTag: number,
items: Array<string>,
error: (error: Object) => void,
success: (event: string, selected?: number) => void,
) => void;
+dismissPopupMenu?: () => void;

// ios only
+lazilyLoadView?: (name: string) => Object; // revisit return
Expand Down