Android Animated timing: interface-only

Summary:
This is (part of) a rewrite of D15390384.

This implements the lifecycle interface only for Fabric to signal to NativeAnimatedModule when preOperations are about to run / operations are about to be dispatched.

We will likely want to remove this mechanism entirely and rewrite NativeAnimatedModule in C++ for Fabric/Venice, but for now, I'm not sure of a better solution to unblock.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D21698193

fbshipit-source-id: a13d445073911fd63d896202a7a1bfbe1167038a
This commit is contained in:
Joshua Gross authored and Facebook GitHub Bot committed 2020-05-26 11:39:28 -07:00
1 parent 8d6cc50d77
commit 0b00d92514
6 files changed
+104 -7

No files matched your search

@@ -34,6 +34,7 @@ import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.bridge.ReadableType;
import com.facebook.react.bridge.UIManager;
import com.facebook.react.bridge.UIManagerListener;
import com.facebook.react.bridge.UiThreadUtil;
import com.facebook.react.bridge.WritableMap;
import com.facebook.react.common.MapBuilder;
@@ -117,6 +118,7 @@ public class UIManagerModule extends ReactContextBaseJavaModule
private final UIImplementation mUIImplementation;
private final MemoryTrimCallback mMemoryTrimCallback = new MemoryTrimCallback();
private final List<UIManagerModuleListener> mListeners = new ArrayList<>();
private final List<UIManagerListener> mUIManagerListeners = new ArrayList<>();
private @Nullable Map<String, WritableMap> mViewManagerConstantsCache;
private volatile int mViewManagerConstantsCacheSize;
@@ -793,6 +795,9 @@ public class UIManagerModule extends ReactContextBaseJavaModule
for (UIManagerModuleListener listener : mListeners) {
listener.willDispatchViewUpdates(this);
}
for (UIManagerListener listener : mUIManagerListeners) {
listener.willDispatchViewUpdates(this);
}
try {
mUIImplementation.dispatchViewUpdates(batchId);
} finally {
@@ -850,14 +855,24 @@ public class UIManagerModule extends ReactContextBaseJavaModule
mUIImplementation.prependUIBlock(block);
}
@Deprecated
public void addUIManagerListener(UIManagerModuleListener listener) {
mListeners.add(listener);
}
@Deprecated
public void removeUIManagerListener(UIManagerModuleListener listener) {
mListeners.remove(listener);
}
public void addUIManagerEventListener(UIManagerListener listener) {
mUIManagerListeners.add(listener);
}
public void removeUIManagerEventListener(UIManagerListener listener) {
mUIManagerListeners.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 will return the same reactTag.