-
Notifications
You must be signed in to change notification settings - Fork 983
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
Added support for a custom container (via getContainer prop) #37
Conversation
This PR also updates the version of 'react-virtualized' used in 'devDependencies' to 7.15 so that a FlexTable example could be added using the new getContainer prop. The PR also adds 'react' to 'devDependencies' since it was missing.
Hey @clauderic :) I tried to keep the change set size minimal and stick with something close to what we discussed earlier via Gitter. Happy to make changes or adjustments! |
Edit: Done via |
This renames ._grid ref to .Grid (since it's now an official part of the API).
|
||
this.container = ReactDOM.findDOMNode(this); | ||
this.container = (typeof getContainer == 'function') ? getContainer(this.getWrappedInstance()) : ReactDOM.findDOMNode(this); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was on the fence about whether the getContainer
prop should return a React element or a DOM node. Thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'd lean towards DOM node, simply because it would enable the use of elements outside of React's scope, for instance, document.body
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's what I thought also. (So that's what it currently does.)
I'm trying to use this new feature (getContainer) and I'm having trouble making it work. Can you provide an example? I seem to be returning the wrong object in this function. I've tried sending the ref object, as well as the dom object returned by |
Hey @joaoreynolds You can see an example here: |
Added support for a custom container (via getContainer prop)
I've also added a new Storybook section demonstrating how this property can be used to integrate with more complex 3rd party components such as
FlexTable
.This PR also updates the version of 'react-virtualized' used in 'devDependencies' to 7.15 (so that a FlexTable example could be added using the new getContainer prop) and adds 'react' to 'devDependencies' since it was missing.