Fix fileIndex not found TypeError (IE 11)

fileIndex is not present in IE 11 Array.prototype
This commit is contained in:
Subroto 2019-01-28 16:43:45 +05:30 committed by 偏右
parent 0b3d7d62fa
commit 7b8a39772b
2 changed files with 5 additions and 2 deletions

View File

@ -3,6 +3,7 @@ import { polyfill } from 'react-lifecycles-compat';
import RcUpload from 'rc-upload';
import classNames from 'classnames';
import uniqBy from 'lodash/uniqBy';
import findIndex from 'lodash/findIndex';
import Dragger from './Dragger';
import UploadList from './UploadList';
import {
@ -73,7 +74,7 @@ class Upload extends React.Component<UploadProps, UploadState> {
const nextFileList = this.state.fileList.concat();
const fileIndex = nextFileList.findIndex(({ uid }) => uid === targetItem.uid);
const fileIndex = findIndex(nextFileList, ({ uid }: UploadFile) => uid === targetItem.uid);
if (fileIndex === -1) {
nextFileList.push(targetItem);
} else {

View File

@ -97,7 +97,9 @@ declare module 'lodash/padEnd';
declare module 'lodash/uniqBy';
declare module "raf";
declare module 'lodash/findIndex';
declare module 'raf';
declare module 'react-lifecycles-compat';