Skip to content

Commit

Permalink
add some of the missing mock methods to BaseAnimationMock (#5384)
Browse files Browse the repository at this point in the history
## Summary

Since with [this
PR](#5380),
a missing easing mock was added, I figured I can extend this a little
bit and add some more mock functions to `BaseAnimationMock`.

PS: I can also add the rest if that's fine with the
maintainers(Including everything that is accessible from
`ComplexAnimationBuilder` and `BaseAnimationBuilder` via dot property
accessor).

---------

Co-authored-by: Uğurcan Emre Ataş <ugurcan.atas@kollex.de>
  • Loading branch information
2 people authored and Aleksandra Cynk committed Dec 12, 2023
1 parent 72065eb commit eb84611
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions src/reanimated2/mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ const ID = (t) => t;
const IMMEDIATE_CB_INVOCATION = (cb: () => unknown) => cb();

class BaseAnimationMock {
createInstance() {
return this;
}

duration(_: number) {
return this;
}
Expand Down Expand Up @@ -48,6 +52,50 @@ class BaseAnimationMock {
return this;
}

rotate(_: string) {
return this;
}

mass(_: number) {
return this;
}

restDisplacementThreshold(_: number) {
return this;
}

restSpeedThreshold(_: number) {
return this;
}

overshootClamping(_: number) {
return this;
}

dampingRatio(_: number) {
return this;
}

getDelay() {
return 0;
}

getDelayFunction() {
return NOOP;
}

getDuration() {
return 300;
}

getReduceMotion() {
return ReduceMotion.System;
}

getAnimationAndConfig() {
return [NOOP, {}];
}

build() {
return () => ({ initialValues: {}, animations: {} });
}
Expand Down

0 comments on commit eb84611

Please sign in to comment.