diff --git a/packages/react-native/ReactAndroid/api/ReactAndroid.api b/packages/react-native/ReactAndroid/api/ReactAndroid.api index 4e8b9a8fe19..063cc9e4bf2 100644 --- a/packages/react-native/ReactAndroid/api/ReactAndroid.api +++ b/packages/react-native/ReactAndroid/api/ReactAndroid.api @@ -4055,7 +4055,7 @@ public abstract interface class com/facebook/react/uimanager/IViewManagerWithChi public class com/facebook/react/uimanager/IllegalViewOperationException : com/facebook/react/bridge/JSApplicationCausedNativeException { public fun (Ljava/lang/String;)V public fun (Ljava/lang/String;Landroid/view/View;Ljava/lang/Throwable;)V - public fun getView ()Landroid/view/View; + public final fun getView ()Landroid/view/View; } public class com/facebook/react/uimanager/JSPointerDispatcher { diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/IllegalViewOperationException.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/IllegalViewOperationException.java deleted file mode 100644 index 215293188ea..00000000000 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/IllegalViewOperationException.java +++ /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 android.view.View; -import androidx.annotation.Nullable; -import com.facebook.infer.annotation.Nullsafe; -import com.facebook.react.bridge.JSApplicationCausedNativeException; - -/** An exception caused by JS requesting the UI manager to perform an illegal view operation. */ -@Nullsafe(Nullsafe.Mode.LOCAL) -public class IllegalViewOperationException extends JSApplicationCausedNativeException { - - @Nullable private View mView; - - public IllegalViewOperationException(String msg) { - super(msg); - } - - public IllegalViewOperationException(String msg, @Nullable View view, Throwable cause) { - super(msg, cause); - mView = view; - } - - @Nullable - public View getView() { - return mView; - } -} diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/IllegalViewOperationException.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/IllegalViewOperationException.kt new file mode 100644 index 00000000000..c03768f9890 --- /dev/null +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/IllegalViewOperationException.kt @@ -0,0 +1,24 @@ +/* + * 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 android.view.View +import com.facebook.react.bridge.JSApplicationCausedNativeException + +/** An exception caused by JS requesting the UI manager to perform an illegal view operation. */ +public open class IllegalViewOperationException : JSApplicationCausedNativeException { + private var view: View? = null + + public constructor(msg: String) : super(msg) + + public constructor(msg: String, view: View?, cause: Throwable) : super(msg, cause) { + this.view = view + } + + public fun getView(): View? = view +}