don't call clearFrameCallback() if we don't have a ReactChoreographer to clear the frame callback on

Reviewed By: achen1

Differential Revision: D4741906

fbshipit-source-id: 2d5fabab6e04c08252513f77149c04e3b8314d2c
This commit is contained in:
Aaron Chiu 2017-03-21 16:01:44 -07:00 committed by Facebook Github Bot
parent 68c655a2fd
commit ba75d99033
1 changed files with 9 additions and 2 deletions

View File

@ -13,6 +13,7 @@ import javax.annotation.Nullable;
import java.util.ArrayList;
import com.facebook.common.logging.FLog;
import com.facebook.infer.annotation.Assertions;
import com.facebook.react.bridge.Arguments;
import com.facebook.react.bridge.Callback;
@ -70,10 +71,12 @@ import com.facebook.react.uimanager.UIManagerModule;
* isolates us from the problems that may be caused by concurrent updates of animated graph while UI
* thread is "executing" the animation loop.
*/
@ReactModule(name = "NativeAnimatedModule")
@ReactModule(name = NativeAnimatedModule.NAME)
public class NativeAnimatedModule extends ReactContextBaseJavaModule implements
OnBatchCompleteListener, LifecycleEventListener {
protected static final String NAME = "NativeAnimatedModule";
private interface UIThreadOperation {
void execute(NativeAnimatedNodesManager animatedNodesManager);
}
@ -159,6 +162,10 @@ public class NativeAnimatedModule extends ReactContextBaseJavaModule implements
@Override
public void onHostPause() {
if (mReactChoreographer == null) {
FLog.e(NAME, "Called NativeAnimated.onHostPause() with a null ReactChoreographer.");
return;
}
clearFrameCallback();
}
@ -169,7 +176,7 @@ public class NativeAnimatedModule extends ReactContextBaseJavaModule implements
@Override
public String getName() {
return "NativeAnimatedModule";
return NAME;
}
private void clearFrameCallback() {