Skip to content
This repository was archived by the owner on Jan 19, 2023. It is now read-only.

Commit 36283be

Browse files
committed
Remove calls to IE-incompatible 'Array.find'
1 parent 2e73976 commit 36283be

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

src/react-image-lightbox.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ class ReactImageLightbox extends Component {
142142
this.moveStartOffsetX = 0;
143143
this.moveStartOffsetY = 0;
144144

145-
// Used to swpie
145+
// Used to swipe
146146
this.swipeStartX = 0;
147147
this.swipeStartY = 0;
148148
this.swipeEndX = 0;
@@ -222,10 +222,8 @@ class ReactImageLightbox extends Component {
222222
}
223223

224224
clearTimeout(id) {
225-
if (this.timeouts.find(tid => tid === id)) {
226-
this.timeouts = this.timeouts.filter(tid => tid !== id);
227-
clearTimeout(id);
228-
}
225+
this.timeouts = this.timeouts.filter(tid => tid !== id);
226+
clearTimeout(id);
229227
}
230228

231229
// Attach key and mouse input events
@@ -1004,8 +1002,13 @@ class ReactImageLightbox extends Component {
10041002

10051003
handlePinch(pointerList) {
10061004
this.pinchTouchList = this.pinchTouchList.map((oldPointer) => {
1007-
const newPointer = pointerList.find(({id: nid}) => nid === oldPointer.id);
1008-
return newPointer || oldPointer;
1005+
for (let i = 0; i < pointerList.length; i++) {
1006+
if (pointerList[i].id === oldPointer.id) {
1007+
return pointerList[i];
1008+
}
1009+
}
1010+
1011+
return oldPointer;
10091012
});
10101013

10111014
const newDistance = this.calculatePinchDistance();

0 commit comments

Comments
 (0)