-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Can't use in react-frame-component #796
Comments
Each iframe get's it's own context / objects. And instanceof just checks the prototype chain - which is why this is failing. Some sort of duck typing could be okay. Although I think it should be hidden behind some helpers and the helpers should have the correct flow types so that the library thinks that it is a HTMLElement |
Portaling something into an iframe is a fairly interesting use case |
I would be keen to see the logic in #797 pulled into some helpers to hide this crazy! |
Just adding that the @jdillick 's branch (https://github.com/jdillick/react-beautiful-dnd/tree/bugfix/duck-type-dom-objects) worked for me (I'm using react-frame-component). |
@alexreardon maybe accept @jdillick 's fix and then request for the helpers? |
We will look at getting something like this in soon |
That issue block me upgrade from version 7 to newer. |
I have the same issue |
I think if we had a small, accurate and shared duck type checker this would be fine to add! |
I am thinking something like this: const isHTMLElement = (el: mixed): boolean => {
return Boolean(el && el.prototype.hasOwnProperty('something'));
} Just need to find something unique to HTMLElement that is fairly trivial to compute: https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement el.prototype.hasOwnProperty('offsetTop'); |
This should be possible now #1067 |
Hi @alexreardon I'm trying to update to v12 and it seam that it not work react-frame-component. I create a sample here: https://codesandbox.io/s/vertical-list-psw70 |
Same here. Cannot use this library in an iframe. Exact same errors as above. |
Ended up using this fork: react-beautiful-dnd-iframe |
I'd suggest opening a new ticket for this, because the issue is closed it's probably not noticed by anyone, and the root cause of this regression appears to be different from the original problem. |
Bug or feature request?
Bug
Expected behavior
When binding react-beautiful-dnd into an iframe portal, for the functionality to continue to work inside the iframe.
Actual behavior
You will get a number of Invariant errors, such as: "provided.innerRef has not been provided with a HTMLElement."
Steps to reproduce
What version of
React
are you using?^16.4.1
What version of
react-beautiful-dnd
are you running?^9.0.1
What browser are you using?
Chrome latest
Demo
Notice that when instanceof is used to check an element in the iframe by the parent window, it will fail. Duck typing these checks will bring back the functionality while retaining some manner of type safety.
The text was updated successfully, but these errors were encountered: