import { useRef } from 'react'; import { useSharedValue } from 'react-native-reanimated'; export function useMemoizedSharedValue(value: T, shouldRebuild = false) { const ref = useRef(null); if (ref.current === null || shouldRebuild) { ref.current = value; } return useSharedValue(ref.current); }