I'm currently utilizing react-moveable to incorporate drag and drop functionality for a specific component. My goal is to hide the control box until the user interacts with the target.
Initially, I attempted to apply custom CSS to the control box, but it seems to be ineffective. Despite the documentation indicating that a className can be assigned, it's not working as expected for me.
Below is a simplified version of the component structure:
import React from "react";
import Moveable from "react-moveable";
import { makeMoveable, DraggableProps, ResizableProps, RotatableProps, Rotatable, Draggable, Resizable } from "react-moveable";
import MoveableHelper from "moveable-helper";
import styles from './label.module.css';
const Label = () => {
const [helper] = React.useState(() => {
return new MoveableHelper();
})
const targetRef = React.useRef<HTMLDivElement>(null);
return (
<div className="container">
<div>
name
</div>
<Moveable
className={styles.moveable1}
target={targetRef}
draggable={true}
resizable={true}
rotatable={true}
origin={false}
onDragStart={helper.onDragStart}
onDrag={helper.onDrag}
onResizeStart={helper.onResizeStart}
onResize={helper.onResize}
onRotateStart={helper.onRotateStart}
onRotate={helper.onRotate}
/>
</div>
);
};
export default Label;
Here is the content of the CSS module file label.module.css:
.moveable1 .moveable-line .moveable-direction {
background: red !important;
}
Despite my attempts to specify the className as a string and make adjustments to the class names in the CSS files, the appearance of the control box remains unchanged. Any insights or suggestions?
Any thoughts on how to tackle this issue?