react-dropzone
Advanced tools
Comparing version 2.1.0 to 2.2.0
21
index.js
@@ -44,5 +44,10 @@ var React = require('react'); | ||
var dataTransferItems = Array.prototype.slice.call(e.dataTransfer ? e.dataTransfer.items : e.target.files); | ||
var allFilesAccepted = this.allFilesAccepted(dataTransferItems); | ||
// This is tricky. During the drag even the dataTransfer.files is null | ||
// But Chrome implements some drag store, which is accesible via dataTransfer.items | ||
var dataTransferItems = e.dataTransfer && e.dataTransfer.items ? e.dataTransfer.items : []; | ||
// Now we need to convert the DataTransferList to Array | ||
var itemsArray = Array.prototype.slice.call(dataTransferItems); | ||
var allFilesAccepted = this.allFilesAccepted(itemsArray); | ||
this.setState({ | ||
@@ -134,5 +139,9 @@ isDragActive: allFilesAccepted, | ||
var style, activeStyle; | ||
if (this.props.style) { | ||
style = this.props.style; | ||
activeStyle = this.props.activeStyle; | ||
if (this.props.style || this.props.activeStyle) { | ||
if (this.props.style) { | ||
style = this.props.style; | ||
} | ||
if (this.props.activeStyle) { | ||
activeStyle = this.props.activeStyle; | ||
} | ||
} else if (!className) { | ||
@@ -154,3 +163,3 @@ style = { | ||
var appliedStyle; | ||
if (style && this.state.isDragActive) { | ||
if (activeStyle && this.state.isDragActive) { | ||
appliedStyle = { | ||
@@ -157,0 +166,0 @@ ...style, |
@@ -53,5 +53,10 @@ 'use strict'; | ||
var dataTransferItems = Array.prototype.slice.call(e.dataTransfer ? e.dataTransfer.items : e.target.files); | ||
var allFilesAccepted = this.allFilesAccepted(dataTransferItems); | ||
// This is tricky. During the drag even the dataTransfer.files is null | ||
// But Chrome implements some drag store, which is accesible via dataTransfer.items | ||
var dataTransferItems = e.dataTransfer && e.dataTransfer.items ? e.dataTransfer.items : []; | ||
// Now we need to convert the DataTransferList to Array | ||
var itemsArray = Array.prototype.slice.call(dataTransferItems); | ||
var allFilesAccepted = this.allFilesAccepted(itemsArray); | ||
this.setState({ | ||
@@ -143,5 +148,9 @@ isDragActive: allFilesAccepted, | ||
var style, activeStyle; | ||
if (this.props.style) { | ||
style = this.props.style; | ||
activeStyle = this.props.activeStyle; | ||
if (this.props.style || this.props.activeStyle) { | ||
if (this.props.style) { | ||
style = this.props.style; | ||
} | ||
if (this.props.activeStyle) { | ||
activeStyle = this.props.activeStyle; | ||
} | ||
} else if (!className) { | ||
@@ -163,3 +172,3 @@ style = { | ||
var appliedStyle; | ||
if (style && this.state.isDragActive) { | ||
if (activeStyle && this.state.isDragActive) { | ||
appliedStyle = _extends({}, style, activeStyle); | ||
@@ -166,0 +175,0 @@ } else { |
{ | ||
"name": "react-dropzone", | ||
"version": "2.1.0", | ||
"version": "2.2.0", | ||
"description": "Simple HTML5 drag-drop zone with React.js", | ||
@@ -27,2 +27,5 @@ "main": "lib/index.js", | ||
"license": "MIT", | ||
"peerDependencies": { | ||
"react": ">=0.13" | ||
}, | ||
"dependencies": { | ||
@@ -29,0 +32,0 @@ "attr-accept": "^1.0.1" |
@@ -17,2 +17,8 @@ react-dropzone | ||
Create a standalone module using *WebPack*: | ||
``` | ||
> npm install | ||
> webpack | ||
``` | ||
Usage | ||
@@ -19,0 +25,0 @@ ===== |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15580
7
347
132
2