-
Notifications
You must be signed in to change notification settings - Fork 24.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: This diff changes the way pre-allocation of views are executed in Fabric. Before this diff the execution of view preallocation was schedulled at the end of the UIThread queue, now the views are pre-allocated in the next "tick" Reviewed By: sahrens Differential Revision: D13857614 fbshipit-source-id: 386bf966d3c8a0d5c0bd626119a92810465aecb7
- Loading branch information
1 parent
4c69ccd
commit 16a6e51
Showing
3 changed files
with
65 additions
and
17 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
36 changes: 36 additions & 0 deletions
36
...src/main/java/com/facebook/react/fabric/mounting/mountitems/PreAllocateViewMountItem.java
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,36 @@ | ||
/** | ||
* Copyright (c) Facebook, Inc. and its 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; | ||
import com.facebook.react.uimanager.ThemedReactContext; | ||
|
||
/** | ||
* {@link MountItem} that is used to pre-allocate views for JS components. | ||
*/ | ||
public class PreAllocateViewMountItem implements MountItem { | ||
|
||
private final String mComponent; | ||
private final int mRootTag; | ||
private final ThemedReactContext mContext; | ||
|
||
public PreAllocateViewMountItem(ThemedReactContext context, int rootTag, String component){ | ||
mContext = context; | ||
mComponent = component; | ||
mRootTag = rootTag; | ||
} | ||
|
||
@Override | ||
public void execute(MountingManager mountingManager) { | ||
mountingManager.preallocateView(mContext, mComponent); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "[" + mRootTag + "] - Preallocate " + mComponent; | ||
} | ||
} |