$ git show marquee

Infinite marquee

Basic/anim marquee

A row of items scrolls sideways forever and loops without a seam. Good for logos and tickers.

Main · New Architecture only · worklets live in react-native-worklets
animationNameanimationIterationCountCSS animations
marquee.tsx · reanimated 4
// Two copies side by side; a CSS animation slides left by one copy's width, forever
const [w, setW] = useState(0);
const marquee = {
  from: { transform: [{ translateX: 0 }] },
  to: { transform: [{ translateX: -w }] },
};

<View style={{ overflow: 'hidden' }}>
  <Animated.View
    style={[{ flexDirection: 'row' }, w > 0 && {
      animationName: marquee,
      animationDuration: w * 25 + 'ms', // ~40 px/s whatever the content width
      animationIterationCount: 'infinite',
      animationTimingFunction: 'linear',
    }]}>
    <View style={{ flexDirection: 'row' }} onLayout={e => setW(e.nativeEvent.layout.width)}>{items}</View>
    <View style={{ flexDirection: 'row' }}>{items}</View>
  </Animated.View>
</View>
// Give every item the same trailing margin (no gap on the row) so the two copies tile exactly.