-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Invariant failed: provided.innerRef has not been provided with a HTMLElement. #2002
Comments
I'm running into the same issue with almost identical code setup. I was trying to pass the dnd props to a child component with no success. I brought all the stuff into one component to test, and I'm having the same problems as Josh. I'm also using React 17.0.1. V13 Dnd and Chrome. |
the lambda expression should have a return value, you should use |
@joshmillgate @Adrean1983 Can you post your repos? ref worked for me. innerRef did not work for me. Also if you implemented @Forfires fix, then you have an issue somewhere else. If you are just returning JSX then you do not need { } and do not have to have the JSX enclosed if it is on one line, or you can wrap it in ( ) if it is multiple lines. If you use { } you have to include "return". This would work |
Hey @joshmillgate, it looks like the Please try the following: <DragDropContext>
<div>
<h1>test</h1>
<Droppable droppableId="test">
- {(provided) => {
+ {(providedDroppable) => {
- <ul {...provided.droppableProps} ref={provided.innerRef}>
+ <ul {...providedDroppable.droppableProps} ref={providedDroppable.innerRef}>
{test.map((testItem) => {
return (
<Draggable draggableId={testItem.key} key={testItem.key} index={testItem.index}>
- {(provided) => {
+ {(providedDraggable) => {
<li {...providedDraggable.draggableProps} {...providedDraggable.dragHandleProps} ref={providedDraggable.innerRef} >{testItem.title}</li>
}}
</Draggable>
)
})}
</ul>
}}
</Droppable>
</div>
</DragDropContext> I've tripped over this a couple of times myself haha 😅, please give it a try and let me know 🙏 |
Will close for now, please reopen if you're still having issues |
thats works, thank you so much! |
Building a Chrome extension using React trying to implement the most basic setup with dnd but running into this issue, tried multiple times with minimum requirements no luck.
Tried both 'innerRef={}' and 'ref={}'
Using this as a boilerplate: https://github.com/lxieyang/chrome-extension-boilerplate-react
Update Got this working using v10...
Are you new to rbd?
First time using, followed guides and same results
Expected behavior
Drop and drag to work normally
Actual behavior
Getting error: "Invariant failed: provided.innerRef has not been provided with a HTMLElement."
Steps to reproduce
Suggested solution?
No
What version of
React
are you using?^17.0.1
What version of
react-beautiful-dnd
are you running?v13, same issue with v12
What browser are you using?
Chrome
The text was updated successfully, but these errors were encountered: