From 9a5894c46ee9fe48644af72da59cc70c83c285ec Mon Sep 17 00:00:00 2001 From: afc163 Date: Mon, 9 Oct 2017 19:41:17 +0800 Subject: [PATCH] data should be call when beforeUpload promise resolved, close #7833 --- components/upload/Upload.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/components/upload/Upload.tsx b/components/upload/Upload.tsx index d607da550a..47b1c23b7e 100644 --- a/components/upload/Upload.tsx +++ b/components/upload/Upload.tsx @@ -219,12 +219,18 @@ export default class Upload extends React.Component { } beforeUpload = (file, fileList) => { - if (this.props.beforeUpload && !this.props.beforeUpload(file, fileList)) { + if (!this.props.beforeUpload) { + return true; + } + const result = this.props.beforeUpload(file, fileList); + if (!result) { this.onChange({ file, fileList, }); return false; + } else if ((result as PromiseLike).then) { + return result; } return true; }