How to track the position of the Draggable component?
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 25/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Necesita aclaración
- Estado de actividad
- Estancado
- Stack tecnológico
- javascript, react
- Área
- frontend
Línea de trabajo
Begin with the Draggable and DraggableCore APIs, focusing on the controlled position prop and the onStop callback shown in the issue. Determine whether the requested parent-state binding is an existing usage or documentation gap or requires a new API; completion should define the supported behavior and include tests if behavior changes.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
I want to track the (x, y) coordinates of the Draggable component.
I can't use the position prop like this, because then I cannot drag the component anymore:
const { posX, posY } = this.state;
return (
...
<Draggable position={{x: posX, y: posY}}>
<div style={{backgroundColor: "green", height: "30px", width: "30px"}}></div>
</Draggable>
...
);
I've looked a bit at the DraggableCore API but I don't see how it could help me.
The only solution I found out yet is to set an onStop handler to the Draggable component like so:
handleOnStop(evt, data) {
const { x, y } = data;
this.setState({posX: x, posY: y});
}
Is there a simpler solution to bind directly the position coordinates in the parent state (posX, posY) to the props of the component?
- Lenguaje dominante
- JavaScript
- Estrellas
- 9.3k
- Forks
- 1k
- Merge medio
- 3 d 8 h
- PR fusionados (30 d)
- 4
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de react-grid-layout/react-draggable
-
Dificultad 3/5 1-2 días Aptitud para principiantes 72/100
-
Dificultad 4/5 3-5 días Aptitud para principiantes 25/100
react-grid-layout/react-draggable#784 · 4 comentarios · 2 reacciones ·
-
V4.5.0 Chrome Extension Error Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 45/100
react-grid-layout/react-draggable#782 · 1 comentario ·
-
Dificultad 3/5 1-2 días Aptitud para principiantes 25/100
react-grid-layout/react-draggable#781 · 1 comentario · 2 reacciones ·
-
the new version 4.5.0 会导致系统打包报错 Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 25/100
react-grid-layout/react-draggable#780 · 8 comentarios ·
Todos los issues de react-grid-layout/react-draggable
Issues similares
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
babalae/bettergi-scripts-list#3674 ·
-
ecosystem wording
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100
matrix-org/matrix.org#3649 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
vadimdemedes/ink#1029 ·
-
code-quality refactoring
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
github/gh-aw-firewall#8816 ·
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
langchain-ai/deepagents#6450 ·