react-native reanimated’s withSequence() not working properly

I have trying to do a sequence animation with loop but the sequences are not running in order as intended. Can anyone help in this to identify what is wrong and tell what to do right?

const animatedStyle = useAnimatedStyle(() => {
    return {
      transform: [
        {
          translateY: withRepeat(
            withSequence(
              withTiming(50, { duration: 200 }, (finished) => {
                if (finished) {
                  console.log('finished first', finished);
                }
              }),
              withTiming(0, { duration: 200 }, (finished) => {
                if (finished) {
                  console.log('finished second', finished);
                }
              }),
              withDelay(
                4000,
                withTiming(-50, { duration: 700 }, (finished) => {
                  if (finished) {
                    console.log('finished third', finished);
                    runOnJS(updateIndexWorklet)();
                  }
                }),
              ),
            ),
            -1,
            false,
            (finished) => {
              console.log('this is: ', finished);
            },
          ),
        },
      ],
    };