Browse Source

Fix `fileIndex` not found TypeError (IE 11)

fileIndex is not present in IE 11 Array.prototype
pull/14615/head
Subroto 6 years ago
committed by 偏右
parent
commit
7b8a39772b
  1. 3
      components/upload/Upload.tsx
  2. 4
      typings/custom-typings.d.ts

3
components/upload/Upload.tsx

@ -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 {

4
typings/custom-typings.d.ts

@ -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';

Loading…
Cancel
Save