diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/FrameBasedAnimationDriver.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/FrameBasedAnimationDriver.java index 798fcffd7442ad..1d58b9991c4d7c 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/FrameBasedAnimationDriver.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/FrameBasedAnimationDriver.java @@ -7,9 +7,12 @@ package com.facebook.react.animated; +import com.facebook.common.logging.FLog; import com.facebook.react.bridge.ReadableArray; import com.facebook.react.bridge.ReadableMap; import com.facebook.react.bridge.ReadableType; +import com.facebook.react.common.ReactConstants; +import com.facebook.react.common.build.ReactBuildConfig; /** * Implementation of {@link AnimationDriver} which provides a support for simple time-based @@ -70,7 +73,14 @@ public void runAnimationStep(long frameTimeNanos) { long timeFromStartMillis = (frameTimeNanos - mStartFrameTimeNanos) / 1000000; int frameIndex = (int) Math.round(timeFromStartMillis / FRAME_TIME_MILLIS); if (frameIndex < 0) { - throw new IllegalStateException("Calculated frame index should never be lower than 0"); + String message = "Calculated frame index should never be lower than 0. Called with frameTimeNanos " + + frameTimeNanos + " and mStartFrameTimeNanos " + mStartFrameTimeNanos; + if (ReactBuildConfig.DEBUG) { + throw new IllegalStateException(message); + } else { + FLog.w(ReactConstants.TAG, message); + return; + } } else if (mHasFinished) { // nothing to do here return;