Skip to content

Commit 9d11dcd

Browse files
chrfalchfacebook-github-bot
authored andcommitted
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: #51322 Test Plan: Verify that Expo can build against this class. Reviewed By: javache Differential Revision: D74807744 Pulled By: cortinico fbshipit-source-id: 55f4b9deccb7d82ceb78be1d56c2b99a6f7e3ce9
1 parent 2fa2c20 commit 9d11dcd

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

packages/react-native/ReactAndroid/api/ReactAndroid.api

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4595,7 +4595,7 @@ public abstract class com/facebook/react/uimanager/ViewGroupManager : com/facebo
45954595
public fun getShadowNodeClass ()Ljava/lang/Class;
45964596
public static final fun getViewZIndex (Landroid/view/View;)Ljava/lang/Integer;
45974597
public fun needsCustomLayoutForChildren ()Z
4598-
public final fun removeView (Landroid/view/ViewGroup;Landroid/view/View;)V
4598+
public fun removeView (Landroid/view/ViewGroup;Landroid/view/View;)V
45994599
public synthetic fun removeViewAt (Landroid/view/View;I)V
46004600
public fun removeViewAt (Landroid/view/ViewGroup;I)V
46014601
public static final fun setViewZIndex (Landroid/view/View;I)V

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewGroupManager.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,12 @@ constructor(reactContext: ReactApplicationContext? = null) :
4949
parent.removeViewAt(index)
5050
}
5151

52-
public fun removeView(parent: T, view: View) {
52+
/**
53+
* Expo overrides this function GroupViewManagerWrapper.kt`, which is a replacement view manager
54+
* adding support for delegates receiving callbacks whenever one of the methods in the view
55+
* manager are called.
56+
*/
57+
public open fun removeView(parent: T, view: View) {
5358
UiThreadUtil.assertOnUiThread()
5459

5560
for (i in 0 until getChildCount(parent)) {

0 commit comments

Comments
 (0)