Draggable does not work as intended in 4.4.6. (Normal operation in 4.4.5)
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 42/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- javascript, react, typescript
- Ambito
- frontend
Direzione di ricerca
Start by reproducing the supplied App component with the Draggable entry point, comparing 4.4.6 against 4.4.5; the examples use App.css and both uncontrolled and state-controlled cases. Trace the handle and nodeRef behavior, then verify that dragging remains effective and that the state example still logs and updates position.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
In version 4.4.6, the mouse leaves the draggable component.
When not to use state
import { useRef } from "react";
import Draggable from "react-draggable";
import "./App.css";
function App() {
const nodeRef = useRef<HTMLDivElement>(null);
return (
<Draggable handle={`.handler`} nodeRef={nodeRef}>
<div ref={nodeRef} style={{ width: "500px" }}>
<div className="handler" style={{ backgroundColor: "gray" }}>
React Draggable 4.4.6
</div>
<div>Body</div>
</div>
</Draggable>
);
}
export default App;
When to use states
import { useCallback, useRef, useState } from "react";
import Draggable, { DraggableData, DraggableEvent } from "react-draggable";
import "./App.css";
function App() {
const nodeRef = useRef<HTMLDivElement>(null);
const [position, setPosition] = useState({ x: 0, y: 0 });
const handleDrag = useCallback((e: DraggableEvent, data: DraggableData) => {
setPosition({ x: data.x, y: data.y });
console.log(data);
}, []);
return (
<Draggable
handle={`.handler`}
nodeRef={nodeRef}
position={position}
onDrag={handleDrag}
>
<div ref={nodeRef} style={{ width: "500px" }}>
<div className="handler" style={{ backgroundColor: "gray" }}>
React Draggable 4.4.6
</div>
<div>Body</div>
</div>
</Draggable>
);
}
export default App;
4.4.6 with console log
https://github.com/react-grid-layout/react-draggable/assets/59780565/a41c47d3-7793-4c68-bae1-f043297eaa22
4.4.5 with console log
https://github.com/react-grid-layout/react-draggable/assets/59780565/04ce9bb2-1aab-43a8-84ff-aea73a704178
- Lingua principale
- JavaScript
- Stelle
- 9.3k
- Fork
- 1k
- Merge medio
- 3g 8h
- PR unite (30g)
- 4
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di react-grid-layout/react-draggable
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 72/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
react-grid-layout/react-draggable#784 · 4 commenti · 2 reazioni ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
react-grid-layout/react-draggable#782 · 1 commento ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 25/100
react-grid-layout/react-draggable#781 · 1 commento · 2 reazioni ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
react-grid-layout/react-draggable#780 · 8 commenti ·
Tutte le issue di react-grid-layout/react-draggable
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
HarperFast/skills#96 ·
-
[Block] Latest Posts [Type] Bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
-
Daemon passes --experimental-wasm-jspi unconditionally on Node >= 24; Node 26 rejects the flag Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
Automattic/studio#4908 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
sugarlabs/musicblocks#8847 ·