@@ -51,6 +51,7 @@ class Image extends React.Component<ImageComponentProps, ImageComponentState> {
5151 width : null ,
5252 height : null ,
5353 loading : true ,
54+ isZooming : false ,
5455 } as ImageComponentState ;
5556
5657 this . _translateXY = new Animated . ValueXY ( ) ;
@@ -103,7 +104,7 @@ class Image extends React.Component<ImageComponentProps, ImageComponentState> {
103104 if ( Math . abs ( gesture . dx ) > Math . abs ( gesture . dy ) ) {
104105 this . props . toggleEnableScroll ( true ) ;
105106
106- return false ;
107+ return ;
107108 }
108109
109110 this . props . toggleEnableScroll ( false ) ;
@@ -160,6 +161,7 @@ class Image extends React.Component<ImageComponentProps, ImageComponentState> {
160161
161162 if ( this . _lastScale > this . _getMinimumScale ( ) ) {
162163 this . _translateXY . setOffset ( { x : 0 , y : 0 } ) ;
164+ this . _setIsZooming ( false ) ;
163165 Animated . parallel ( [
164166 Animated . timing ( this . _translateXY , {
165167 toValue : { x : 0 , y : 0 } ,
@@ -229,6 +231,7 @@ class Image extends React.Component<ImageComponentProps, ImageComponentState> {
229231 this . _lastOffset = { x, y} ;
230232 } ) ;
231233 this . _lastScale = scale ;
234+ this . _setIsZooming ( true ) ;
232235 this . props . toggleEnableScroll ( false ) ;
233236 }
234237 } ;
@@ -263,8 +266,10 @@ class Image extends React.Component<ImageComponentProps, ImageComponentState> {
263266 if ( scale < this . _getMinimumScale ( ) ) {
264267 scale = this . _getMinimumScale ( ) ;
265268 this . props . toggleEnableScroll ( true ) ;
269+ this . _setIsZooming ( false ) ;
266270 } else {
267271 scale = Math . min ( this . _getMaximumScale ( ) , scale ) ;
272+ this . _setIsZooming ( true ) ;
268273 }
269274
270275 this . _lastScale = scale ;
@@ -291,17 +296,24 @@ class Image extends React.Component<ImageComponentProps, ImageComponentState> {
291296
292297 if ( scale < this . _getMinimumScale ( ) ) {
293298 this . _scale . setValue ( this . _getMinimumScale ( ) ) ;
299+ this . _setIsZooming ( false ) ;
294300 } else {
295301 this . _scale . setValue ( Math . min ( this . _getMaximumScale ( ) , scale ) ) ;
302+ this . _setIsZooming ( true ) ;
296303 }
297304
298305 this . props . toggleEnableScroll ( false ) ;
299306 }
300307 } ;
301308
302309 private _debug = ( ...args : any [ ] ) => this . props . debug && console . log ( ...args ) ;
310+ private _setIsZooming = ( isZooming : boolean ) => this . setState ( { isZooming} , ( ) => this . props . onZoomStateChange ( isZooming ) ) ;
303311
304312 private _renderHeader = ( ) => {
313+ if ( this . state . isZooming ) {
314+ return null ;
315+ }
316+
305317 const headerAnim : any = [
306318 styles . header ,
307319 {
@@ -333,6 +345,10 @@ class Image extends React.Component<ImageComponentProps, ImageComponentState> {
333345 return null ;
334346 }
335347
348+ if ( this . state . isZooming ) {
349+ return null ;
350+ }
351+
336352 let innerComponent ;
337353 if ( renderFooter !== undefined ) {
338354 if ( typeof renderFooter !== 'function' ) {
@@ -425,7 +441,7 @@ class Image extends React.Component<ImageComponentProps, ImageComponentState> {
425441 return (
426442 < View style = { styles . container } >
427443 < Animated . View style = { backdropStyle } { ...this . _panResponder . panHandlers } />
428- < Animated . View style = { moveObjStyle } { ...this . _panResponder . panHandlers } >
444+ < Animated . View style = { moveObjStyle } { ...this . _panResponder . panHandlers } renderToHardwareTextureAndroid >
429445 < TapGestureHandler numberOfTaps = { 2 } onActivated = { this . _handleImageZoomInOut } >
430446 < PinchGestureHandler
431447 onGestureEvent = { this . _onPinchGestureEvent }
0 commit comments