diff --git a/components/ReadFileDropContainer.js b/components/ReadFileDropContainer.js index 805b0ef..326ca7f 100644 --- a/components/ReadFileDropContainer.js +++ b/components/ReadFileDropContainer.js @@ -14,51 +14,30 @@ const spec = { const collect = (connect, monitor) => ({ connectDropTarget: connect.dropTarget(), isOver: monitor.isOver() }) -class ReadFileDropContainer extends React.Component { - constructor(props) { - super(props) - this.state = { isFileOver: false } - } - - componentWillReceiveProps(nextProps) { - if (!this.props.isOver && nextProps.isOver) { - this.setState({ isFileOver: true }) - } - - if (this.props.isOver && !nextProps.isOver) { - this.setState({ isFileOver: false }) - } - } - - render() { - const content = ( -
- { this.state.isFileOver ?
Drop your file here to import
: null } - { this.props.children } - -
- ) - - return this.props.connectDropTarget(content) - } -} +const ReadFileDropContainer = props => props.connectDropTarget( +
+ { props.isOver ?
Drop your file here to import
: null } + {props.children} + +
+) export default DropTarget(NativeTypes.FILE, spec, collect)(ReadFileDropContainer)