Avoid repeated value read in SubtractionAnimatedNode

Summary:
Minor optimization, but spotted this while reviewing the implementation for D33622997

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D33622996

fbshipit-source-id: 8712753803fc46e6a046d50f77454a813e4a641a
This commit is contained in:
Pieter De Baets
2022-01-18 13:53:43 -08:00
committed by Facebook GitHub Bot
parent b2105711a0
commit 08e76772fe
5 changed files with 8 additions and 8 deletions
@@ -27,11 +27,11 @@ import com.facebook.react.bridge.ReadableMap;
public void update() {
AnimatedNode animatedNode = mNativeAnimatedNodesManager.getNodeById(mInputNode);
if (animatedNode != null && animatedNode instanceof ValueAnimatedNode) {
final double value = ((ValueAnimatedNode) animatedNode).getValue();
double value = ((ValueAnimatedNode) animatedNode).getValue();
mValue = (value % mModulus + mModulus) % mModulus;
} else {
throw new JSApplicationCausedNativeException(
"Illegal node ID set as an input for " + "Animated.modulus node");
"Illegal node ID set as an input for Animated.modulus node");
}
}