Delete NoSuchNativeViewException (#53946)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53946

NoSuchNativeViewException is legacy architecture and unused, let's delete it

changelog: [internal] internal

Reviewed By: alanleedev

Differential Revision: D83186872

fbshipit-source-id: cbd3b2f537673745e634d0bfc8717fc93f1c0c5f
This commit is contained in:
David Vacca
2025-09-26 14:07:25 -07:00
committed by Facebook GitHub Bot
parent 589bf35cd1
commit 163d553ba2
3 changed files with 5 additions and 39 deletions
@@ -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);
@@ -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,
)
}
}
}
@@ -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();