Skip to content

error in react 19 #771

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
daviderusso1984 opened this issue Dec 15, 2024 · 9 comments
Open

error in react 19 #771

daviderusso1984 opened this issue Dec 15, 2024 · 9 comments

Comments

@daviderusso1984
Copy link

Draggable.js:210 Uncaught TypeError: _reactDom.default.findDOMNode is not a function
at Draggable.findDOMNode (Draggable.js:210:1)
at Draggable.componentDidMount (Draggable.js:194:1)
at react-stack-bottom-frame (react-dom-client.development.js:22451:1)
at runWithFiberInDEV (react-dom-client.development.js:543:1)
at commitLayoutEffectOnFiber (react-dom-client.development.js:11419:1)
at recursivelyTraverseLayoutEffects (react-dom-client.development.js:12410:1)
at commitLayoutEffectOnFiber (react-dom-client.development.js:11413:1)
at recursivelyTraverseLayoutEffects (react-dom-client.development.js:12410:1)
at commitLayoutEffectOnFiber (react-dom-client.development.js:11529:1)
at recursivelyTraverseLayoutEffects (react-dom-client.development.js:12410:1)

@Mirott
Copy link

Mirott commented Dec 16, 2024

I have the same problem

@andreatiled
Copy link

A simple workaround is to provide a ref to a child element:

<Draggable nodeRef={myRef}>
   <div ref={myRef} />
</Draggable>

ErikMN added a commit to ErikMN/widget_wizard that referenced this issue Jan 6, 2025
But not React 18 to 19 because it breaks react-draggable:
react-grid-layout/react-draggable#771
@SValentyn
Copy link

SValentyn commented Feb 13, 2025

Thanks andreatiled
The workaround above worked for me, but there were type conflicts, so I had to manually set the ref type.

in child component:

const CountryPopup = forwardRef<HTMLDivElement, CountryPopupProps>(({country}, ref) => {
    return (
        <Draggable
            nodeRef={ref as RefObject<HTMLElement>}
            allowAnyClick={true}
        >
            <div
                ref={ref}
                ...

in parent component:

...
const popupRef = useRef<HTMLDivElement>(null);
...
<CountryPopup ref={popupRef} country={currentCountry}/>

@siamahnaf
Copy link

very important package it is. React 19 support is required now. If anyone using alternative package please inform me?

@ellis
Copy link

ellis commented Feb 19, 2025

Thanks @andreatiled ! That worked for me.
Like @SValentyn , I also had a type error, but I just cast it.

@galangel
Copy link

@andreatiled
Thank you very much

@rhyek
Copy link

rhyek commented Apr 27, 2025

The nodeRef solution does not work when actually using React 19. More info here.

@Floryvibla
Copy link

The nodeRef solution does not work when actually using React 19. More info here.

It works, you need to type it like @SValentyn comment mentioned

@rhyek
Copy link

rhyek commented May 6, 2025

The nodeRef solution does not work when actually using React 19. More info here.

It works, you need to type it like @SValentyn comment mentioned

It's not about types. Did you read the issue I linked?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants