Skip to main content

Knight Moves

A chess knight puzzle — drag the knight to valid L-shaped moves. Demonstrates conditional drop acceptance with acceptsDrag.

Key Concepts

  • Conditional acceptance — only valid knight moves are accepted
  • acceptsDrag — returns true only for L-shaped destinations
  • Visual feedback — valid squares highlight during drag
  • Grid layout — 8x8 chess board

Features Shown

FeatureHow
acceptsDragValidates L-shaped knight moves
receivingStyleValid squares highlight green
payloadKnight carries its current position
Grid of DraxViews64 squares, each a receptive DraxView

Source Code

example/app/(tabs)/knight-moves.tsx
// Full source available at:
// https://github.com/nuclearpasta/react-native-drax/blob/main/example/app/(tabs)/knight-moves.tsx