{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "marquee",
  "title": "Marquee",
  "type": "registry:ui",
  "files": [
    {
      "path": "packages/registry-native/components/marquee/Marquee.tsx",
      "content": "import * as React from 'react'\nimport { AppState, ScrollView, View, type AppStateStatus, type LayoutChangeEvent, type ViewProps } from 'react-native'\nimport Animated, {\n  cancelAnimation,\n  Easing,\n  useAnimatedStyle,\n  useReducedMotion,\n  useSharedValue,\n  withRepeat,\n  withTiming,\n} from 'react-native-reanimated'\nimport { motionDurations } from '@/lib/motion'\nimport { cn } from '@/lib/utils'\n\nconst DEFAULT_SPEED = 48\nconst DEFAULT_GAP = 24\nconst OVERFLOW_THRESHOLD = 1\n\nexport type MarqueeDirection = 'left' | 'right'\n\nexport interface MarqueeHandle {\n  /** Reset the marquee scroll offset to `0` and restart the loop if eligible. */\n  reset: () => void\n}\n\nexport interface MarqueeProps extends ViewProps {\n  children?: React.ReactNode\n  /** Scroll speed in pixels per second. Must be finite and `> 0` (defaults to `48`). */\n  speed?: number\n  /** Horizontal gap in pixels between seamless loop copies. Clamped to `>= 0` (defaults to `24`). */\n  gap?: number\n  /** Travel direction of the scrolling strip (defaults to `'left'`). */\n  direction?: MarqueeDirection\n  /** Pause scrolling and fall back to a static single copy. */\n  paused?: boolean\n  /** Classes applied to the outer bounded viewport `View`. */\n  className?: string\n}\n\nexport const Marquee = React.forwardRef<MarqueeHandle, MarqueeProps>(\n  (\n    {\n      children,\n      speed = DEFAULT_SPEED,\n      gap = DEFAULT_GAP,\n      direction = 'left',\n      paused = false,\n      className,\n      onLayout,\n      ...props\n    },\n    ref,\n  ) => {\n    const reducedMotion = useReducedMotion()\n    const [appActive, setAppActive] = React.useState(() => AppState.currentState === 'active')\n    const [viewportWidth, setViewportWidth] = React.useState(0)\n    const [contentWidth, setContentWidth] = React.useState(0)\n    const [resetCount, setResetCount] = React.useState(0)\n\n    const translateX = useSharedValue(0)\n    const isAnimatingRef = React.useRef(false)\n\n    React.useEffect(() => {\n      const subscription = AppState.addEventListener('change', (nextState: AppStateStatus) => {\n        setAppActive(nextState === 'active')\n      })\n      return () => subscription.remove()\n    }, [])\n\n    const safeSpeed = Number.isFinite(speed) && speed > 0 ? speed : DEFAULT_SPEED\n    const safeGap = Number.isFinite(gap) ? Math.max(0, gap) : DEFAULT_GAP\n\n    const isOverflowing = viewportWidth > 0 && contentWidth > viewportWidth + OVERFLOW_THRESHOLD\n    const shouldAnimate = isOverflowing && !paused && !reducedMotion && appActive\n\n    React.useImperativeHandle(\n      ref,\n      () => ({\n        reset: () => {\n          cancelAnimation(translateX)\n          isAnimatingRef.current = false\n          translateX.value = 0\n          setResetCount((count) => count + 1)\n        },\n      }),\n      [translateX],\n    )\n\n    React.useEffect(() => {\n      if (!shouldAnimate) {\n        if (isAnimatingRef.current) {\n          cancelAnimation(translateX)\n          isAnimatingRef.current = false\n        }\n        translateX.value = 0\n        return\n      }\n\n      const cycleDistance = contentWidth + safeGap\n      const duration = Math.max(motionDurations.fast, Math.round((cycleDistance / safeSpeed) * 1000))\n\n      isAnimatingRef.current = true\n      if (direction === 'right') {\n        translateX.value = -cycleDistance\n        translateX.value = withRepeat(withTiming(0, { duration, easing: Easing.linear }), -1, false)\n      } else {\n        translateX.value = 0\n        translateX.value = withRepeat(withTiming(-cycleDistance, { duration, easing: Easing.linear }), -1, false)\n      }\n\n      return () => {\n        cancelAnimation(translateX)\n        isAnimatingRef.current = false\n      }\n    }, [shouldAnimate, contentWidth, safeGap, safeSpeed, direction, resetCount, translateX])\n\n    const trackStyle = useAnimatedStyle(() => ({\n      transform: [{ translateX: translateX.value }],\n    }))\n\n    const handleViewportLayout = (event: LayoutChangeEvent) => {\n      const nextWidth = Math.max(0, event.nativeEvent.layout.width)\n      setViewportWidth((prev) => (Math.abs(prev - nextWidth) < 0.5 ? prev : nextWidth))\n      onLayout?.(event)\n    }\n\n    const handleContentLayout = (event: LayoutChangeEvent) => {\n      const nextWidth = Math.max(0, event.nativeEvent.layout.width)\n      setContentWidth((prev) => (Math.abs(prev - nextWidth) < 0.5 ? prev : nextWidth))\n    }\n\n    return (\n      <View {...props} className={cn('overflow-hidden', className)} onLayout={handleViewportLayout}>\n        <ScrollView horizontal scrollEnabled={false} showsHorizontalScrollIndicator={false}>\n          <Animated.View style={[{ flexDirection: 'row', alignItems: 'center' }, trackStyle]}>\n            <View onLayout={handleContentLayout} style={{ flexDirection: 'row', alignItems: 'center', flexShrink: 0 }}>\n              {children}\n            </View>\n            {shouldAnimate ? (\n              <View\n                accessible={false}\n                accessibilityElementsHidden\n                importantForAccessibility=\"no-hide-descendants\"\n                style={{ flexDirection: 'row', alignItems: 'center', flexShrink: 0, marginLeft: safeGap }}\n              >\n                {children}\n              </View>\n            ) : null}\n          </Animated.View>\n        </ScrollView>\n      </View>\n    )\n  },\n)\nMarquee.displayName = 'Marquee'\n",
      "type": "registry:ui",
      "target": "~/components/ui/marquee/Marquee.tsx"
    },
    {
      "path": "packages/registry-native/components/marquee/index.ts",
      "content": "export { Marquee, type MarqueeDirection, type MarqueeHandle, type MarqueeProps } from './Marquee'\n",
      "type": "registry:ui",
      "target": "~/components/ui/marquee/index.ts"
    }
  ],
  "dependencies": [
    "react-native-reanimated"
  ],
  "devDependencies": [],
  "registryDependencies": [
    "https://native.uipkge.dev/r/native/motion.json",
    "https://native.uipkge.dev/r/native/utils.json"
  ],
  "description": "Measured-overflow horizontal scrolling strip with pause/reset/direction controls, reduced-motion static fallback, and AppState lifecycle stop.",
  "categories": [
    "data-display"
  ]
}