mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Back out "[react-native] Remove experimental gating for LayoutAnimation on Android"
Summary: We've identified a couple of remaining issues that need to be re-tested before we can ship this more broadly. Reviewed By: fred2028 Differential Revision: D14775730 fbshipit-source-id: 22402149066c5fbe72c36fcf7f547d63feaf5241
This commit is contained in:
1 parent
691f2f9d02
commit
d9a82221a4
7 files changed
+67
-12
No files matched your search
+11
-3
@@ -74,6 +74,7 @@ public class NativeViewHierarchyManager {
|
||||
private final LayoutAnimationController mLayoutAnimator = new LayoutAnimationController();
|
||||
private final Map<Integer, SparseIntArray> mTagsToPendingIndicesToDelete = new HashMap<>();
|
||||
|
||||
private boolean mLayoutAnimationEnabled;
|
||||
private PopupMenu mPopupMenu;
|
||||
|
||||
public NativeViewHierarchyManager(ViewManagerRegistry viewManagers) {
|
||||
@@ -105,6 +106,10 @@ public class NativeViewHierarchyManager {
|
||||
return viewManager;
|
||||
}
|
||||
|
||||
public void setLayoutAnimationEnabled(boolean enabled) {
|
||||
mLayoutAnimationEnabled = enabled;
|
||||
}
|
||||
|
||||
public synchronized void updateInstanceHandle(int tag, long instanceHandle) {
|
||||
UiThreadUtil.assertOnUiThread();
|
||||
|
||||
@@ -220,7 +225,8 @@ public class NativeViewHierarchyManager {
|
||||
}
|
||||
|
||||
private void updateLayout(View viewToUpdate, int x, int y, int width, int height) {
|
||||
if (mLayoutAnimator.shouldAnimateLayout(viewToUpdate)) {
|
||||
if (mLayoutAnimationEnabled &&
|
||||
mLayoutAnimator.shouldAnimateLayout(viewToUpdate)) {
|
||||
mLayoutAnimator.applyLayoutUpdate(viewToUpdate, x, y, width, height);
|
||||
} else {
|
||||
viewToUpdate.layout(x, y, x + width, y + height);
|
||||
@@ -427,7 +433,8 @@ public class NativeViewHierarchyManager {
|
||||
int normalizedIndexToRemove = normalizeIndex(indexToRemove, pendingIndicesToDelete);
|
||||
View viewToRemove = viewManager.getChildAt(viewToManage, normalizedIndexToRemove);
|
||||
|
||||
if (mLayoutAnimator.shouldAnimateLayout(viewToRemove) &&
|
||||
if (mLayoutAnimationEnabled &&
|
||||
mLayoutAnimator.shouldAnimateLayout(viewToRemove) &&
|
||||
arrayContains(tagsToDelete, viewToRemove.getId())) {
|
||||
// The view will be removed and dropped by the 'delete' layout animation
|
||||
// instead, so do nothing
|
||||
@@ -476,7 +483,8 @@ public class NativeViewHierarchyManager {
|
||||
tagsToDelete));
|
||||
}
|
||||
|
||||
if (mLayoutAnimator.shouldAnimateLayout(viewToDestroy)) {
|
||||
if (mLayoutAnimationEnabled &&
|
||||
mLayoutAnimator.shouldAnimateLayout(viewToDestroy)) {
|
||||
int updatedCount = pendingIndicesToDelete.get(indexToDelete, 0) + 1;
|
||||
pendingIndicesToDelete.put(indexToDelete, updatedCount);
|
||||
mLayoutAnimator.deleteView(
|
||||
|
||||
Reference in new issue
Block a user