@@ -180,9 +180,9 @@ export default class ImageViewer extends React.Component<Props, State> {
180180 }
181181
182182 // 如果已知源图片宽高,直接设置为 success
183- if ( image . width && image . height ) {
184- if ( this . props . enablePreload && imageLoaded === false ) {
185- Image . prefetch ( image . url )
183+ if ( image . width && image . height ) {
184+ if ( this . props . enablePreload && imageLoaded === false ) {
185+ Image . prefetch ( image . url ) ;
186186 }
187187 imageStatus . width = image . width ;
188188 imageStatus . height = image . height ;
@@ -216,13 +216,13 @@ export default class ImageViewer extends React.Component<Props, State> {
216216 }
217217
218218 /**
219- * 预加载图片
220- */
221- public preloadImage = ( index : number ) => {
222- if ( index < this . state . imageSizes ! . length ) {
219+ * 预加载图片
220+ */
221+ public preloadImage = ( index : number ) => {
222+ if ( index < this . state . imageSizes ! . length ) {
223223 this . loadImage ( index + 1 ) ;
224224 }
225- }
225+ } ;
226226 /**
227227 * 触发溢出水平滚动
228228 */
@@ -526,8 +526,8 @@ export default class ImageViewer extends React.Component<Props, State> {
526526 ...image . props . source
527527 } ;
528528 }
529- if ( this . props . enablePreload ) {
530- this . preloadImage ( this . state . currentShowIndex || 0 )
529+ if ( this . props . enablePreload ) {
530+ this . preloadImage ( this . state . currentShowIndex || 0 ) ;
531531 }
532532 return (
533533 < ImageZoom
@@ -548,8 +548,8 @@ export default class ImageViewer extends React.Component<Props, State> {
548548 swipeDownThreshold = { this . props . swipeDownThreshold }
549549 onSwipeDown = { this . handleSwipeDown }
550550 panToMove = { ! this . state . isShowMenu }
551- pinchToZoom = { this . props . enableImageZoom && ! this . state . isShowMenu }
552- enableDoubleClickZoom = { this . props . enableImageZoom && ! this . state . isShowMenu }
551+ pinchToZoom = { this . props . enableImageZoom && ! this . state . isShowMenu }
552+ enableDoubleClickZoom = { this . props . enableImageZoom && ! this . state . isShowMenu }
553553 doubleClickInterval = { this . props . doubleClickInterval }
554554 >
555555 { this ! . props ! . renderImage ! ( image . props ) }
@@ -616,7 +616,7 @@ export default class ImageViewer extends React.Component<Props, State> {
616616 </ View >
617617 ) }
618618 < View style = { [ { bottom : 0 , position : 'absolute' , zIndex : 9 } , this . props . footerContainerStyle ] } >
619- { this ! . props ! . renderFooter ! ( this . state . currentShowIndex ) }
619+ { this ! . props ! . renderFooter ! ( this . state . currentShowIndex || - 1 ) }
620620 </ View >
621621 </ Animated . View >
622622 </ Animated . View >
@@ -642,12 +642,12 @@ export default class ImageViewer extends React.Component<Props, State> {
642642 return null ;
643643 }
644644
645- if ( this . props . menus ) {
645+ if ( this . props . menus ) {
646646 return (
647- < View style = { this . styles . menuContainer } >
648- { this . props . menus ( { cancel :this . handleLeaveMenu , saveToLocal :this . saveToLocal } ) }
649- </ View >
650- )
647+ < View style = { this . styles . menuContainer } >
648+ { this . props . menus ( { cancel : this . handleLeaveMenu , saveToLocal : this . saveToLocal } ) }
649+ </ View >
650+ ) ;
651651 }
652652
653653 return (
0 commit comments