Last active
September 15, 2016 09:00
ReactDropzone, a react component for interfacing with http://www.dropzonejs.com/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** @jsx React.DOM */ | |
| var ReactDropzone = React.createClass({ | |
| componentDidMount: function() { | |
| var options = {}; | |
| for (var opt in Dropzone.prototype.defaultOptions) { | |
| var prop = this.props[opt]; | |
| if (prop) { | |
| options[opt] = prop; | |
| continue; | |
| } | |
| options[opt] = Dropzone.prototype.defaultOptions[opt]; | |
| } | |
| this.dropzone = new Dropzone(this.getDOMNode(), options); | |
| }, | |
| componentWillUnmount: function() { | |
| this.dropzone.destroy(); | |
| this.dropzone = null; | |
| }, | |
| render: function() { | |
| var children = this.props.children; | |
| return this.transferPropsTo( | |
| <form> | |
| {children ? <div className="fallback">{children}</div> : null} | |
| </form> | |
| ); | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How did you manage the problem with the KEY (data-reactid) when you use a template for the file previews?.. I haven't been able to handle this problem.