make removeView open in ViewGroupManager (#51322)

Summary:
After conversion to Kotlin we could no longer override the removeView function since it is no longer open. The rest of this class can be overridden as before, but since functions are final by default this doesn't work for the new `removeView` function.

Expo is overriding the `removeView` functions in `GroupViewManagerWrapper.kt` (a lot of other ViewManager methods are also overridden here, but the `removeView` is introduced in `ViewGroupManager` and needs to be open as well. `GroupViewManagerWrapper.kt` is a replacement view manager that adds support for a delegate that will receive callbacks whenever one of the methods in the view manager are called.

This commit fixes this by making the removeView function explicitly open.

## Changelog:

[ANDROID] [FIXED] - Made function `removeView` open in Kotlin class

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

Test Plan: Verify that Expo can build against this class.

Reviewed By: javache

Differential Revision: D74807744

Pulled By: cortinico

fbshipit-source-id: 55f4b9deccb7d82ceb78be1d56c2b99a6f7e3ce9
This commit is contained in:
Christian Falch
2025-05-15 10:36:14 -07:00
committed by Facebook GitHub Bot
parent 2fa2c2071c
commit 9d11dcd3b0
2 changed files with 7 additions and 2 deletions
@@ -4595,7 +4595,7 @@ public abstract class com/facebook/react/uimanager/ViewGroupManager : com/facebo
public fun getShadowNodeClass ()Ljava/lang/Class;
public static final fun getViewZIndex (Landroid/view/View;)Ljava/lang/Integer;
public fun needsCustomLayoutForChildren ()Z
public final fun removeView (Landroid/view/ViewGroup;Landroid/view/View;)V
public fun removeView (Landroid/view/ViewGroup;Landroid/view/View;)V
public synthetic fun removeViewAt (Landroid/view/View;I)V
public fun removeViewAt (Landroid/view/ViewGroup;I)V
public static final fun setViewZIndex (Landroid/view/View;I)V
@@ -49,7 +49,12 @@ constructor(reactContext: ReactApplicationContext? = null) :
parent.removeViewAt(index)
}
public fun removeView(parent: T, view: View) {
/**
* Expo overrides this function GroupViewManagerWrapper.kt`, which is a replacement view manager
* adding support for delegates receiving callbacks whenever one of the methods in the view
* manager are called.
*/
public open fun removeView(parent: T, view: View) {
UiThreadUtil.assertOnUiThread()
for (i in 0 until getChildCount(parent)) {