I have attached the snack for better clarity. I am trying to achieve an animation similar to the iOS/Android notification bar.
I am successfully able to drag the handlebar to the bottom using the below-given code:
const translateY = cond(
eq(gestureState, State.END),
[
cond(
greaterThan(dragY, 0),
set(
dragY,
runTiming(clockY, dragY, velocityY, 400, gestureState, () => {
console.log('f1');
}),
),
set(
dragY,
runTiming(clockY, dragY, velocityY, 0, gestureState, () => {
console.log('f2');
}),
),
),
set(offsetY, dragY),
dragY,
],
cond(
eq(gestureState, State.BEGAN),
[stopClock(clockY), finalDragY],
finalDragY,
),
);
But, while trying to animate it from the bottom, it just snaps the handlebar to the bottom and then animates it to the top. On debugging further, I realized that the translated position resets and then it animates.