Skip to content

ADD: Animation Exception Patch #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: 0.71.12
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ public void update() {
if (animatedNode != null && animatedNode instanceof ValueAnimatedNode) {
mValue += ((ValueAnimatedNode) animatedNode).getValue();
} else {
throw new JSApplicationCausedNativeException(
"Illegal node ID set as an input for Animated.Add node");
//PATCH: COMMENTED
// throw new JSApplicationCausedNativeException(
// "Illegal node ID set as an input for Animated.Add node");
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
* start animating with the new properties (different destination or spring settings)
*/
public void resetConfig(ReadableMap config) {
throw new JSApplicationCausedNativeException(
"Animation config for " + getClass().getSimpleName() + " cannot be reset");
//PATCH: COMMENTED
// throw new JSApplicationCausedNativeException(
// "Animation config for " + getClass().getSimpleName() + " cannot be reset");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@ public void update() {
private double getInputNodeValue() {
AnimatedNode animatedNode = mNativeAnimatedNodesManager.getNodeById(mInputNodeTag);
if (animatedNode == null || !(animatedNode instanceof ValueAnimatedNode)) {
throw new JSApplicationCausedNativeException(
"Illegal node ID set as an input for Animated.DiffClamp node");
//PATCH: COMMENTED
// throw new JSApplicationCausedNativeException(
// "Illegal node ID set as an input for Animated.DiffClamp node");
return;
}

return ((ValueAnimatedNode) animatedNode).getValue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,18 @@ public void update() {
continue;
}
if (value == 0) {
throw new JSApplicationCausedNativeException(
"Detected a division by zero in Animated.divide node with Animated ID " + mTag);
//PATCH: COMMENTED
// throw new JSApplicationCausedNativeException(
// "Detected a division by zero in Animated.divide node with Animated ID " + mTag);
return;
}
mValue /= value;
} else {
throw new JSApplicationCausedNativeException(
"Illegal node ID set as an input for Animated.divide node with Animated ID " + mTag);
}
}
//PATCH: COMMENTED
// else {
// throw new JSApplicationCausedNativeException(
// "Illegal node ID set as an input for Animated.divide node with Animated ID " + mTag);
// }
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ public EventAnimationDriver(
@Override
public void receiveEvent(int targetTag, String eventName, @Nullable WritableMap event) {
if (event == null) {
throw new IllegalArgumentException("Native animated events must have event data.");
//PATCH: COMMENTED
// throw new IllegalArgumentException("Native animated events must have event data.");
return;
}

// Get the new value for the node by looking into the event map using the provided event path.
Expand All @@ -51,10 +53,12 @@ public void receiveEvent(int targetTag, String eventName, @Nullable WritableMap
} else if (keyType == ReadableType.Array) {
currArray = currMap.getArray(key);
currMap = null;
} else {
throw new UnexpectedNativeTypeException(
"Unexpected type " + keyType + " for key '" + key + "'");
}
//PATCH: COMMENTED
// else {
// throw new UnexpectedNativeTypeException(
// "Unexpected type " + keyType + " for key '" + key + "'");
// }
} else {
int index = Integer.parseInt(mEventPath.get(i));
ReadableType keyType = currArray.getType(index);
Expand All @@ -64,10 +68,12 @@ public void receiveEvent(int targetTag, String eventName, @Nullable WritableMap
} else if (keyType == ReadableType.Array) {
currArray = currArray.getArray(index);
currMap = null;
} else {
throw new UnexpectedNativeTypeException(
"Unexpected type " + keyType + " for index '" + index + "'");
}
}
//PATCH: COMMENTED
// else {
// throw new UnexpectedNativeTypeException(
// "Unexpected type " + keyType + " for index '" + index + "'");
// }
}
}

Expand All @@ -83,6 +89,7 @@ public void receiveEvent(int targetTag, String eventName, @Nullable WritableMap
@Override
public void receiveTouches(
String eventName, WritableArray touches, WritableArray changedIndices) {
throw new RuntimeException("receiveTouches is not support by native animated events");
//PATCH: COMMENTED
// throw new RuntimeException("receiveTouches is not support by native animated events");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,10 @@ private static double interpolate(
case EXTRAPOLATE_TYPE_EXTEND:
break;
default:
throw new JSApplicationIllegalArgumentException(
"Invalid extrapolation type " + extrapolateLeft + "for left extrapolation");
//PATCH: COMMENTED
// throw new JSApplicationIllegalArgumentException(
// "Invalid extrapolation type " + extrapolateRight + "for left extrapolation");
return;
}
}

Expand All @@ -74,8 +76,10 @@ private static double interpolate(
case EXTRAPOLATE_TYPE_EXTEND:
break;
default:
throw new JSApplicationIllegalArgumentException(
"Invalid extrapolation type " + extrapolateRight + "for right extrapolation");
//PATCH: COMMENTED
// throw new JSApplicationIllegalArgumentException(
// "Invalid extrapolation type " + extrapolateRight + "for right extrapolation");
return;
}
}

Expand Down Expand Up @@ -191,18 +195,24 @@ public InterpolationAnimatedNode(ReadableMap config) {
@Override
public void onAttachedToNode(AnimatedNode parent) {
if (mParent != null) {
throw new IllegalStateException("Parent already attached");
//PATCH: COMMENTED
// throw new IllegalStateException("Parent already attached");
return;
}
if (!(parent instanceof ValueAnimatedNode)) {
throw new IllegalArgumentException("Parent is of an invalid type");
//PATCH: COMMENTED
// throw new IllegalArgumentException("Parent is of an invalid type");
return;
}
mParent = (ValueAnimatedNode) parent;
}

@Override
public void onDetachedFromNode(AnimatedNode parent) {
if (parent != mParent) {
throw new IllegalArgumentException("Invalid parent node provided");
//PATCH: COMMENTED
// throw new IllegalArgumentException("Invalid parent node provided");
return;
}
mParent = null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ public void update() {
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");
//PATCH: COMMENTED
// throw new JSApplicationCausedNativeException(
// "Illegal node ID set as an input for Animated.modulus node");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ public void update() {
if (animatedNode != null && animatedNode instanceof ValueAnimatedNode) {
mValue *= ((ValueAnimatedNode) animatedNode).getValue();
} else {
throw new JSApplicationCausedNativeException(
"Illegal node ID set as an input for Animated.multiply node");
//PATCH: COMMENTED
// throw new JSApplicationCausedNativeException(
// "Illegal node ID set as an input for Animated.multiply node");
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,8 @@ protected void doFrameGuarded(final long frameTimeNanos) {
ReactChoreographer.CallbackType.NATIVE_ANIMATED_MODULE,
mAnimatedFrameCallback);
} catch (Exception ex) {
throw new RuntimeException(ex);
//PATCH: COMMENTED
// throw new RuntimeException(ex);
}
}
};
Expand Down
Loading