-
Notifications
You must be signed in to change notification settings - Fork 24.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Delete pre-allocated views that were never mounted on the screen (#46473
) Summary: Pull Request resolved: #46473 This diff extends the renderer of react native to ensure that pre-allocated views that were never mounted on the screen are deleted as soon as the shadow node is deleted from JS This feature is controlled by the ReactNativeFeatureFlag: enableDeletionOfUnmountedViews changelog: [internal] internal Reviewed By: javache Differential Revision: D62559190 fbshipit-source-id: 1af6785fc57256d12750db64489c9ecc6cf98c9d
- Loading branch information
1 parent
68a92aa
commit 6dbbbe3
Showing
10 changed files
with
129 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
.../main/java/com/facebook/react/fabric/mounting/mountitems/DestroyUnmountedViewMountItem.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* 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.fabric.mounting.mountitems | ||
|
||
import com.facebook.react.fabric.mounting.MountingManager | ||
|
||
/** | ||
* Destroyes the view asociated to the [reactTag] if exists. This MountItem is meant to be used ONLY | ||
* for views that were preallcated but never mounted on the screen. | ||
*/ | ||
internal class DestroyUnmountedViewMountItem( | ||
private val _surfaceId: Int, | ||
private val reactTag: Int | ||
) : MountItem { | ||
|
||
public override fun execute(mountingManager: MountingManager) { | ||
val surfaceMountingManager = mountingManager.getSurfaceManager(_surfaceId) | ||
if (surfaceMountingManager == null) { | ||
return | ||
} | ||
surfaceMountingManager.deleteView(reactTag) | ||
} | ||
|
||
public override fun getSurfaceId(): Int = _surfaceId | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters