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 af824f92bb0..2063e79fc67 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 @@ -706,14 +706,14 @@ public class NativeViewHierarchyManager { UiThreadUtil.assertOnUiThread(); View v = mTagsToViews.get(tag); if (v == null) { - throw new NoSuchNativeViewException("No native view for " + tag + " currently exists"); + throw new IllegalViewOperationException("No native view for " + tag + " currently exists"); } View rootView = (View) RootViewUtil.getRootView(v); // It is possible that the RootView can't be found because this view is no longer on the screen // and has been removed by clipping if (rootView == null) { - throw new NoSuchNativeViewException("Native view " + tag + " is no longer on screen"); + throw new IllegalViewOperationException("Native view " + tag + " is no longer on screen"); } computeBoundingBox(rootView, outputBuffer); int rootX = outputBuffer[0]; @@ -773,7 +773,7 @@ public class NativeViewHierarchyManager { UiThreadUtil.assertOnUiThread(); View v = mTagsToViews.get(tag); if (v == null) { - throw new NoSuchNativeViewException("No native view for " + tag + " currently exists"); + throw new IllegalViewOperationException("No native view for " + tag + " currently exists"); } v.getLocationOnScreen(outputBuffer); diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/NoSuchNativeViewException.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/NoSuchNativeViewException.kt deleted file mode 100644 index 0d128e43976..00000000000 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/NoSuchNativeViewException.kt +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -package com.facebook.react.uimanager - -import com.facebook.react.common.annotations.internal.LegacyArchitecture -import com.facebook.react.common.annotations.internal.LegacyArchitectureLogLevel -import com.facebook.react.common.annotations.internal.LegacyArchitectureLogger - -/** - * Exception thrown when a class tries to access a native view by a tag that has no native view - * associated with it. - */ -@LegacyArchitecture(logLevel = LegacyArchitectureLogLevel.ERROR) -@Deprecated( - message = "This class is part of Legacy Architecture and will be removed in a future release", - level = DeprecationLevel.WARNING, -) -internal class NoSuchNativeViewException(detailMessage: String) : - IllegalViewOperationException(detailMessage) { - - private companion object { - init { - LegacyArchitectureLogger.assertLegacyArchitecture( - "NoSuchNativeViewException", - LegacyArchitectureLogLevel.ERROR, - ) - } - } -} 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 339f94da9ce..6745ca88c5f 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 @@ -418,7 +418,7 @@ public class UIViewOperationQueue { public void execute() { try { mNativeViewHierarchyManager.measure(mReactTag, mMeasureBuffer); - } catch (NoSuchNativeViewException e) { + } catch (IllegalViewOperationException e) { // Invoke with no args to signal failure and to allow JS to clean up the callback // handle. mCallback.invoke(); @@ -448,7 +448,7 @@ public class UIViewOperationQueue { public void execute() { try { mNativeViewHierarchyManager.measureInWindow(mReactTag, mMeasureBuffer); - } catch (NoSuchNativeViewException e) { + } catch (IllegalViewOperationException e) { // Invoke with no args to signal failure and to allow JS to clean up the callback // handle. mCallback.invoke();