willb335 / chessboardjsx

:black_square_button: Chessboard built for React
https://chessboardjsx.com
MIT License
267 stars 79 forks source link

onDrop with sparePieces #44

Closed claudioluciano closed 5 years ago

claudioluciano commented 5 years ago

When using sparePieces={true} and try to put a spare piece on the board i get this error Uncaught TypeError: s is not a function at Object.endDrag (chessboard.min.js:2478) at t.value (chessboard.min.js:6563) at e.t.endDrag (chessboard.min.js:314) at Object.r.<computed> [as endDrag] (chessboard.min.js:8169) at e.handleTopDragEndCapture (chessboard.min.js:5998)

when is not a spare piece works fine

willb335 commented 5 years ago

Can you try using the id prop for the board?

claudioluciano commented 5 years ago

Same problem

willb335 commented 5 years ago

ok, I'm going to need some more info to try to solve this. Can you post the code of your chessboard and any code that renders the chessboard?

claudioluciano commented 5 years ago

Hey Will here a working exemple of the bug, https://codesandbox.io/s/cool-rain-6jwdp just open the browser console and try put a spare piece on the board

willb335 commented 5 years ago

It's working as it should for me. Strange, I'm on a mac running codesandbox with chrome. That's bizarre

claudioluciano commented 5 years ago

Hey Will sorry, i think the link above is wrong, this is the right link https://codesandbox.io/s/great-payne-9dzd8, for the bug work you need the onDrop function...

willb335 commented 5 years ago

Could you checkout the spareOnDrop branch and run yarn start. Then click the 'Show Spare OnDrop' button to run the demo. You can change the demo code at integrations/SpareOnDrop

claudioluciano commented 5 years ago

hey Will nice work, the branch spareOnDrop works fine : D

willb335 commented 5 years ago

ok, nice. fixed with 6a7b2b8