Comments (2)
Hi! Promotion field should reprezent to which piece you want to promote your pawn, which has reached to the final line. In chess.js
library It can be only one of the listed values ['q', 'r', 'b', 'n']
. Try this instead:
try{
const move = chess.move({from: source, to: target, promotion: promotion[1].toLowerCase() ?? "q"});
setBoard(chess.fen());
}
from react-chessboard.
Hi! Promotion field should reprezent to which piece you want to promote your pawn, which has reached to the final line. In
chess.js
library It can be only one of the listed values['q', 'r', 'b', 'n']
. Try this instead:try{ const move = chess.move({from: source, to: target, promotion: promotion[1].toLowerCase() ?? "q"}); setBoard(chess.fen()); }
Brilliant, it worked!!
Thank you so much, I can't believe I missed such a detail haha.
from react-chessboard.
Related Issues (20)
- onPromotionCheck for squareClick HOT 4
- Animation skips after failed drag move HOT 1
- How i can add pieces from outside the board ? HOT 3
- Feature Request: Add Circle Annotations to Squares HOT 3
- Positioning issue if FEN string changes completely HOT 7
- Premove back to existing premove square causes piece to disappear HOT 5
- Board resets to previous state despite value of `position` HOT 8
- Got error when run in dev environment HOT 2
- showPromotionDialog prop not working as expected HOT 1
- Issue with isDraggablePiece update HOT 2
- Feature Request: Exposing the `Square` and `PieceSymbol` in the `onSquareClick()` and `onPieceClick()` handlers HOT 7
- No moves are available with custom positions HOT 2
- Show Dead Pieces HOT 2
- pieces dont snap back into place in touch screen HOT 2
- Bug: Pieces land below the square on small boards HOT 2
- Best way to to get and display piece svgs outside of the chessboard? HOT 1
- Drag and drop pieces not working on laptop with touch screen. HOT 4
- Small artifact on a1 when hovering square (only on Microsoft Edge) HOT 4
- Is it possible to adapt it to a player vs. player game? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-chessboard.