File tree 2 files changed +9
-4
lines changed
2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " react-slick" ,
3
- "version" : " 0.27.2 " ,
3
+ "version" : " 0.27.3 " ,
4
4
"description" : " React port of slick carousel" ,
5
5
"main" : " ./lib" ,
6
6
"files" : [
Original file line number Diff line number Diff line change 1
1
import React from "react" ;
2
2
3
+ export function clamp ( number , lowerBound , upperBound ) {
4
+ return Math . max ( lowerBound , Math . min ( number , upperBound ) ) ;
5
+ }
6
+
3
7
export const getOnDemandLazySlides = spec => {
4
8
let onDemandSlides = [ ] ;
5
9
let startIndex = lazyStartIndex ( spec ) ;
@@ -172,6 +176,7 @@ export const slideHandler = spec => {
172
176
finalLeft ;
173
177
let state = { } ,
174
178
nextState = { } ;
179
+ const targetSlide = infinite ? index : clamp ( index , 0 , slideCount ) ;
175
180
if ( fade ) {
176
181
if ( ! infinite && ( index < 0 || index >= slideCount ) ) return { } ;
177
182
if ( index < 0 ) {
@@ -220,22 +225,22 @@ export const slideHandler = spec => {
220
225
currentSlide : finalSlide ,
221
226
trackStyle : getTrackCSS ( { ...spec , left : finalLeft } ) ,
222
227
lazyLoadedList,
223
- targetSlide : index
228
+ targetSlide
224
229
} ;
225
230
} else {
226
231
state = {
227
232
animating : true ,
228
233
currentSlide : finalSlide ,
229
234
trackStyle : getTrackAnimateCSS ( { ...spec , left : animationLeft } ) ,
230
235
lazyLoadedList,
231
- targetSlide : index
236
+ targetSlide
232
237
} ;
233
238
nextState = {
234
239
animating : false ,
235
240
currentSlide : finalSlide ,
236
241
trackStyle : getTrackCSS ( { ...spec , left : finalLeft } ) ,
237
242
swipeLeft : null ,
238
- targetSlide : index
243
+ targetSlide
239
244
} ;
240
245
}
241
246
}
You can’t perform that action at this time.
0 commit comments