$ git show tab-indicator
Sliding tab indicator
An underline moves and resizes to match the selected tab, using measured layouts.
HomeExploreYou
This snippet uses APIs that didn’t change between versions, so the same code runs on Reanimated 4 and 3.
const layouts = useRef([]);
const x = useSharedValue(0), w = useSharedValue(0);
useEffect(() => {
const l = layouts.current[active];
if (l) { x.value = withSpring(l.x, { damping: 18 }); w.value = withSpring(l.width, { damping: 18 }); }
}, [active]);
const indicator = useAnimatedStyle(() => ({ width: w.value, transform: [{ translateX: x.value }] }));
// each tab: onLayout={e => (layouts.current[i] = e.nativeEvent.layout)}