Native Animated - Restore default values when removing props on Android

Summary:
Rebased version of #12842 that was reverted because of failing fb internal tests.
Closes https://github.com/facebook/react-native/pull/15919

Differential Revision: D5823956

Pulled By: hramos

fbshipit-source-id: 4ece19a403f5ebbe4829c4c26696ea0575ab1d0e
This commit is contained in:
Janic Duplessis authored and Facebook Github Bot committed 2017-10-12 13:11:00 -07:00
1 parent dd400f842b
commit 2b4ff6ea19
9 files changed
+230 -72

No files matched your search

@@ -979,6 +979,10 @@ public class UIImplementation {
mOperationsQueue.enqueueUIBlock(block);
}
public void prependUIBlock(UIBlock block) {
mOperationsQueue.prependUIBlock(block);
}
public int resolveRootTagFromReactTag(int reactTag) {
if (mShadowNodeRegistry.isRootNode(reactTag)) {
return reactTag;
@@ -39,6 +39,8 @@ import com.facebook.react.uimanager.debug.NotThreadSafeViewHierarchyUpdateDebugL
import com.facebook.react.uimanager.events.EventDispatcher;
import com.facebook.systrace.Systrace;
import com.facebook.systrace.SystraceMessage;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.annotation.Nullable;
@@ -112,6 +114,7 @@ public class UIManagerModule extends ReactContextBaseJavaModule implements
private final Map<String, Object> mCustomDirectEvents;
private final UIImplementation mUIImplementation;
private final MemoryTrimCallback mMemoryTrimCallback = new MemoryTrimCallback();
private final List<UIManagerModuleListener> mListeners = new ArrayList<>();
private int mBatchId = 0;
@@ -662,6 +665,9 @@ public class UIManagerModule extends ReactContextBaseJavaModule implements
SystraceMessage.beginSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE, "onBatchCompleteUI")
.arg("BatchId", batchId)
.flush();
for (UIManagerModuleListener listener : mListeners) {
listener.willDispatchViewUpdates(this);
}
try {
mUIImplementation.dispatchViewUpdates(batchId);
} finally {
@@ -699,10 +705,28 @@ public class UIManagerModule extends ReactContextBaseJavaModule implements
}
});
*/
public void addUIBlock (UIBlock block) {
public void addUIBlock(UIBlock block) {
mUIImplementation.addUIBlock(block);
}
/**
* Schedule a block to be executed on the UI thread. Useful if you need to execute
* view logic before all currently queued view updates have completed.
*
* @param block that contains UI logic you want to execute.
*/
public void prependUIBlock(UIBlock block) {
mUIImplementation.prependUIBlock(block);
}
public void addUIManagerListener(UIManagerModuleListener listener) {
mListeners.add(listener);
}
public void removeUIManagerListener(UIManagerModuleListener listener) {
mListeners.remove(listener);
}
/**
* Given a reactTag from a component, find its root node tag, if possible.
* Otherwise, this will return 0. If the reactTag belongs to a root node, this
@@ -0,0 +1,21 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
package com.facebook.react.uimanager;
/**
* Listener used to hook into the UIManager update process.
*/
public interface UIManagerModuleListener {
/**
* Called right before view updates are dispatched at the end of a batch. This is useful if a
* module needs to add UIBlocks to the queue before it is flushed.
*/
void willDispatchViewUpdates(UIManagerModule uiManager);
}
@@ -758,6 +758,10 @@ public class UIViewOperationQueue {
mOperations.add(new UIBlockOperation(block));
}
public void prependUIBlock(UIBlock block) {
mOperations.add(0, new UIBlockOperation(block));
}
/* package */ void dispatchViewUpdates(
final int batchId, final long commitStartTime, final long layoutTime) {
SystraceMessage.beginSection(