Native Animated - Restore default values when removing props on Android

Summary:
Same as #11819 but for Android. I didn't notice the bug initially in my app because I was using different animations on Android which did not trigger this issue.

**Test plan**
Created a simple repro example and tested that this fixes it. https://gist.github.com/janicduplessis/0f3eb362dae63fedf99a0d3ee041796a
Closes https://github.com/facebook/react-native/pull/12842

Differential Revision: D5556439

Pulled By: hramos

fbshipit-source-id: d13f4ad258d03cca46c793751ebc49d942b99152
This commit is contained in:
Janic Duplessis
2017-08-04 13:46:39 -07:00
committed by Facebook Github Bot
parent b4f91be647
commit ac43548063
10 changed files with 352 additions and 72 deletions

View File

@@ -11,6 +11,7 @@ package com.facebook.react.uimanager;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -85,6 +86,7 @@ public class UIManagerModule extends ReactContextBaseJavaModule implements
private final Map<String, Object> mModuleConstants;
private final UIImplementation mUIImplementation;
private final MemoryTrimCallback mMemoryTrimCallback = new MemoryTrimCallback();
private final List<UIManagerModuleListener> mListeners = new ArrayList<>();
private int mNextRootViewTag = 1;
private int mBatchId = 0;
@@ -533,6 +535,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 {
@@ -570,10 +575,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