@@ -52,7 +52,7 @@ export class InnerSlider extends React.Component {
52
52
this . list . style . height = getHeight ( elem ) + "px" ;
53
53
}
54
54
} ;
55
- componentWillMount = ( ) => {
55
+ UNSAFE_componentWillMount = ( ) => {
56
56
this . ssrInit ( ) ;
57
57
this . props . onInit && this . props . onInit ( ) ;
58
58
if ( this . props . lazyLoad ) {
@@ -107,7 +107,7 @@ export class InnerSlider extends React.Component {
107
107
window . attachEvent ( "onresize" , this . onWindowResized ) ;
108
108
}
109
109
} ;
110
- componentWillUnmount = ( ) => {
110
+ UNSAFE_componentWillUnmount = ( ) => {
111
111
if ( this . animationEndCallback ) {
112
112
clearTimeout ( this . animationEndCallback ) ;
113
113
}
@@ -127,7 +127,7 @@ export class InnerSlider extends React.Component {
127
127
clearInterval ( this . autoplayTimer ) ;
128
128
}
129
129
} ;
130
- componentWillReceiveProps = nextProps => {
130
+ UNSAFE_componentWillReceiveProps = nextProps => {
131
131
let spec = {
132
132
listRef : this . list ,
133
133
trackRef : this . track ,
@@ -264,9 +264,7 @@ export class InnerSlider extends React.Component {
264
264
} ;
265
265
if ( this . props . centerMode ) {
266
266
let currentWidth = `${ childrenWidths [ this . state . currentSlide ] } px` ;
267
- trackStyle . left = `calc(${
268
- trackStyle . left
269
- } + (100% - ${ currentWidth } ) / 2 ) `;
267
+ trackStyle . left = `calc(${ trackStyle . left } + (100% - ${ currentWidth } ) / 2 ) ` ;
270
268
}
271
269
this . setState ( {
272
270
trackStyle
@@ -276,15 +274,15 @@ export class InnerSlider extends React.Component {
276
274
let childrenCount = React . Children . count ( this . props . children ) ;
277
275
const spec = { ...this . props , ...this . state , slideCount : childrenCount } ;
278
276
let slideCount = getPreClones ( spec ) + getPostClones ( spec ) + childrenCount ;
279
- let trackWidth = 100 / this . props . slidesToShow * slideCount ;
277
+ let trackWidth = ( 100 / this . props . slidesToShow ) * slideCount ;
280
278
let slideWidth = 100 / slideCount ;
281
279
let trackLeft =
282
- - slideWidth *
283
- ( getPreClones ( spec ) + this . state . currentSlide ) *
284
- trackWidth /
280
+ ( - slideWidth *
281
+ ( getPreClones ( spec ) + this . state . currentSlide ) *
282
+ trackWidth ) /
285
283
100 ;
286
284
if ( this . props . centerMode ) {
287
- trackLeft += ( 100 - slideWidth * trackWidth / 100 ) / 2 ;
285
+ trackLeft += ( 100 - ( slideWidth * trackWidth ) / 100 ) / 2 ;
288
286
}
289
287
let trackStyle = {
290
288
width : trackWidth + "%" ,
@@ -390,8 +388,7 @@ export class InnerSlider extends React.Component {
390
388
) ;
391
389
onLazyLoad && slidesToLoad . length > 0 && onLazyLoad ( slidesToLoad ) ;
392
390
this . setState ( state , ( ) => {
393
- asNavFor &&
394
- asNavFor . innerSlider . slideHandler ( index ) ;
391
+ asNavFor && asNavFor . innerSlider . slideHandler ( index ) ;
395
392
if ( ! nextState ) return ;
396
393
this . animationEndCallback = setTimeout ( ( ) => {
397
394
const { animating, ...firstBatch } = nextState ;
0 commit comments