기본 사용법
Factory API
Factory API가 기본 API입니다. Deck state, action, event, interaction shared value, 또는 여러 named instance가 필요하다면 factory API를 사용하세요.
Factory는 Root, Card, hook이 같은 item type을 공유하도록 해 JSX에서 generic을
반복하지 않아도 됩니다.
Card Render Info
Card는 mounted item마다 render info를 받습니다.
Interactive Card Content
Card는 기본적으로 non-interactive입니다. 그래야 deck이 swipe gesture를 안전하게 소유할 수 있습니다.
Active card 안에 CTA button이나 link 같은 touchable children이 있다면 interactive를 사용하세요.
일부 item에서만 touchable children을 열어야 한다면 predicate form을 사용하세요.
interactive는 active card에만 적용됩니다. 뒤쪽 card는 계속 non-interactive입니다.
Card 내부 carousel이나 scroll view처럼 더 깊은 nested gesture 조정은 raw pointerEvents를
노출하기보다 별도의 gesture-coordination API로 다루는 것이 좋습니다.
Allowed Directions
allowedDirections는 dismiss로 받아들일 방향을 제한합니다.
- 생략하면 left와 right를 허용합니다.
- upward dismiss는
'up'을 명시적으로 포함해야 합니다. - gesture up은 기본값인
SwipeDeckMotion.tinder({ drag: { mode: 'free' } })에서 동작합니다. drag.mode: 'horizontal'은 gesture up만 거절하며actions.swipeUp()은 막지 않습니다.[]는 drag는 허용하지만 모든 dismiss release와 programmatic swipe action을 거절합니다.
Static API
Card rendering만 필요하고 factory hook이 필요 없다면 static API를 사용할 수 있습니다.
Static Root는 id를 받지 않습니다. Static Root와 Card는 factory처럼 item type을
함께 고정하지 않으므로, typed render prop이 필요하면 Card에 item type을 직접 넘기세요.
