react-images-uploading
Advanced tools
Comparing version 2.2.0 to 2.2.1
@@ -138,3 +138,3 @@ 'use strict'; | ||
var useRef = React.useRef, useState = React.useState, useEffect = React.useEffect; | ||
var useRef = React.useRef, useState = React.useState, useCallback = React.useCallback; | ||
var defaultErrors = { | ||
@@ -167,9 +167,18 @@ maxFileSize: false, | ||
}; | ||
var onImageUpload = function () { | ||
var handleClickInput = useCallback(function () { | ||
inputRef.current && inputRef.current.click(); | ||
}; | ||
var onImageRemoveAll = function () { | ||
}, [inputRef]); | ||
var onImageUpload = useCallback(function () { | ||
setKeyUpdate(function (prevKey) { | ||
if (prevKey) { | ||
return ""; | ||
} | ||
return prevKey; | ||
}); | ||
handleClickInput(); | ||
}, [handleClickInput]); | ||
var onImageRemoveAll = useCallback(function () { | ||
setImageList([]); | ||
onStandardizeDataChange([]); | ||
}; | ||
}, []); | ||
var onImageRemove = function (key) { | ||
@@ -182,9 +191,5 @@ setImageList(function (previousList) { | ||
}; | ||
useEffect(function () { | ||
if (keyUpdate) { | ||
onImageUpload(); | ||
} | ||
}, [keyUpdate]); | ||
var onImageUpdate = function (key) { | ||
setKeyUpdate(key); | ||
handleClickInput(); | ||
}; | ||
@@ -267,3 +272,3 @@ var getListFile = function (files) { | ||
files = e.target.files; | ||
if (!files) return [3 /*break*/, 4]; | ||
if (!files) return [3 /*break*/, 3]; | ||
return [4 /*yield*/, getListFile(files)]; | ||
@@ -302,4 +307,5 @@ case 1: | ||
keyUpdate && setKeyUpdate(""); | ||
_a.label = 4; | ||
case 4: return [2 /*return*/]; | ||
if (inputRef.current) | ||
inputRef.current.value = ""; | ||
return [2 /*return*/]; | ||
} | ||
@@ -306,0 +312,0 @@ }); |
{ | ||
"name": "react-images-uploading", | ||
"version": "2.2.0", | ||
"version": "2.2.1", | ||
"description": "A simple images uploader without UI. Building by yourself", | ||
@@ -5,0 +5,0 @@ "author": "imvutoan", |
Sorry, the diff of this file is not supported yet
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
55671
359