Skip to content

Commit

Permalink
Update context type in TS tests (#1135)
Browse files Browse the repository at this point in the history
  • Loading branch information
jakub-gonet authored Aug 18, 2020
1 parent 3b95860 commit 74d60cf
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions react-native-reanimated-tests.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@ function AnimatedScrollHandlerTest() {
function AnimatedGestureHandlerTest() {
const x = useSharedValue(0);
const gestureHandler = useAnimatedGestureHandler({
onStart: (_, ctx) => {
onStart: (_, ctx: { startX: number }) => {
ctx.startX = x.value;
},
onActive: (event, ctx) => {
onActive: (event, ctx: { startX: number }) => {
x.value = ctx.startX + event.translationX;
},
onEnd: (_) => {
Expand Down Expand Up @@ -147,10 +147,10 @@ function WithTimingTest() {
function WithSpringTest() {
const x = useSharedValue(0);
const gestureHandler = useAnimatedGestureHandler({
onStart: (_, ctx) => {
onStart: (_, ctx: { startX: number }) => {
ctx.startX = x.value;
},
onActive: (event, ctx) => {
onActive: (event, ctx: { startX: number }) => {
x.value = ctx.startX + event.translationX;
},
onEnd: (_) => {
Expand All @@ -177,10 +177,10 @@ function WithSpringTest() {
function CancelAnimationTest() {
const x = useSharedValue(0);
const gestureHandler = useAnimatedGestureHandler({
onStart: (_, ctx) => {
onStart: (_, ctx: { startX: number }) => {
cancelAnimation(x);
},
onActive: (event, ctx) => {
onActive: (event, ctx: { startX: number }) => {
x.value = ctx.startX + event.translationX;
},
onEnd: (_) => {
Expand All @@ -207,10 +207,10 @@ function CancelAnimationTest() {
function DelayTest() {
const x = useSharedValue(0);
const gestureHandler = useAnimatedGestureHandler({
onStart: (_, ctx) => {
onStart: (_, _ctx) => {
cancelAnimation(x);
},
onActive: (event, ctx) => {
onActive: (event, ctx: { startX: number }) => {
x.value = ctx.startX + event.translationX;
},
onEnd: (_) => {
Expand All @@ -237,10 +237,10 @@ function DelayTest() {
function RepeatTest() {
const x = useSharedValue(0);
const gestureHandler = useAnimatedGestureHandler({
onStart: (_, ctx) => {
onStart: (_, _ctx) => {
cancelAnimation(x);
},
onActive: (event, ctx) => {
onActive: (event, ctx: { startX: number }) => {
x.value = ctx.startX + event.translationX;
},
onEnd: (_) => {
Expand All @@ -267,10 +267,10 @@ function RepeatTest() {
function SequenceTest() {
const x = useSharedValue(0);
const gestureHandler = useAnimatedGestureHandler({
onStart: (_, ctx) => {
onStart: (_, _ctx) => {
cancelAnimation(x);
},
onActive: (event, ctx) => {
onActive: (event, ctx: { startX: number }) => {
x.value = ctx.startX + event.translationX;
},
onEnd: (_) => {
Expand Down Expand Up @@ -298,10 +298,10 @@ function WithDecayTest() {
const x = useSharedValue(0);

const gestureHandler = useAnimatedGestureHandler({
onStart: (_, ctx) => {
onStart: (_, ctx: { startX: number }) => {
ctx.startX = x.value;
},
onActive: (event, ctx) => {
onActive: (event, ctx: { startX: number }) => {
x.value = ctx.startX + event.translationX;
},
onEnd: (evt) => {
Expand Down

0 comments on commit 74d60cf

Please sign in to comment.