$ git show click-wheel

iPod click wheel

Advanced/anim click-wheel

Turn a circular wheel with your finger to move a selection up and down a list, with a click on each step.

Inspired by iPodFrom William Candillon’s “Can it be done in React Native?” series. The code here is a simplified rewrite for Reanimated 4 and 3.
Main · New Architecture only · worklets live in react-native-worklets
Gesture.PanMath.atan2useAnimatedReaction
click-wheel.tsx · reanimated 4
import { scheduleOnRN } from 'react-native-worklets';

const angle = useSharedValue(0), last = useSharedValue(0);
const pan = Gesture.Pan()
  .onBegin(e => { last.value = Math.atan2(e.y - R, e.x - R); })
  .onUpdate(e => {
    const a = Math.atan2(e.y - R, e.x - R);
    let d = a - last.value;                 // unwrap across the -PI/PI seam
    if (d > Math.PI) d -= 2 * Math.PI;
    if (d < -Math.PI) d += 2 * Math.PI;
    angle.value += d; last.value = a;
  });
const STEP = Math.PI / 6; // 30 degrees per item
const selected = useDerivedValue(() => clamp(Math.round(angle.value / STEP), 0, items.length - 1));
useAnimatedReaction(() => selected.value, (v, prev) => {
  if (prev !== null && v !== prev) scheduleOnRN(Haptics.selectionAsync);
});
const highlight = useAnimatedStyle(() => ({ transform: [{ translateY: withSpring(selected.value * ROW_H) }] }));