import type { ReactNode } from 'react'; import { ScrollView, View, type NativeScrollEvent, type NativeSyntheticEvent } from 'react-native'; /** 옆으로 한 장씩 넘기는 슬라이드 (웹 Embla 캐러셀 대신 가로 paging ScrollView) */ export function Pager({ width, height, onIndex, children }: { width: number; height: number; onIndex: (i: number) => void; children: ReactNode[] }) { const onEnd = (e: NativeSyntheticEvent) => onIndex(Math.round(e.nativeEvent.contentOffset.x / width)); return ( 1} onMomentumScrollEnd={onEnd} style={{ width, height }}> {children.map((c, i) => ( {c} ))} ); } /** 슬라이드 위치 점 */ export function Dots({ n, index }: { n: number; index: number }) { if (n < 2) return null; const items = Array.from({ length: n }, (_, i) => i); return ( {items.map((i) => ( ))} ); }