@@ -24,12 +24,12 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
2424} ;
2525import React from 'react' ;
2626import { Animated , Image as RNImage , ActivityIndicator , PanResponder , Dimensions , StyleSheet , View , Text , SafeAreaView , Platform , } from 'react-native' ;
27- import { GestureDetector , Gesture , } from 'react-native-gesture-handler' ;
27+ import { GestureDetector , Gesture , gestureHandlerRootHOC , } from 'react-native-gesture-handler' ;
2828var SCREEN_WIDTH = Dimensions . get ( 'window' ) . width ;
2929var SCREEN_HEIGHT = Dimensions . get ( 'window' ) . height ;
30- var Image = /** @class */ ( function ( _super ) {
31- __extends ( Image , _super ) ;
32- function Image ( props ) {
30+ var ImageComponent = /** @class */ ( function ( _super ) {
31+ __extends ( ImageComponent , _super ) ;
32+ function ImageComponent ( props ) {
3333 var _this = _super . call ( this , props ) || this ;
3434 _this . _scale = new Animated . Value ( 1 ) ;
3535 _this . _lastOffset = { x : 0 , y : 0 } ;
@@ -264,10 +264,10 @@ var Image = /** @class */ (function (_super) {
264264 } ) ;
265265 return _this ;
266266 }
267- Image . prototype . _onShouldSetPanResponder = function ( evt ) {
267+ ImageComponent . prototype . _onShouldSetPanResponder = function ( evt ) {
268268 return evt . nativeEvent . touches . length === 1 ;
269269 } ;
270- Image . prototype . _onPanResponderMove = function ( _evt , gesture ) {
270+ ImageComponent . prototype . _onPanResponderMove = function ( _evt , gesture ) {
271271 this . _debug ( '_onPanResponderMove' , 'dx' , gesture . dx , 'dy' , gesture . dy , this . _lastOffset ) ;
272272 this . _isGestureMoved = true ;
273273 if ( this . _lastScale > this . _getMinimumScale ( ) ) {
@@ -293,7 +293,7 @@ var Image = /** @class */ (function (_super) {
293293 this . props . onZoomStateChange ( true ) ;
294294 this . _translateXY . setValue ( { x : 0 , y : Math . max ( 0 , gesture . dy ) } ) ;
295295 } ;
296- Image . prototype . _onPanResponderEnd = function ( _evt , gesture ) {
296+ ImageComponent . prototype . _onPanResponderEnd = function ( _evt , gesture ) {
297297 var _this = this ;
298298 if ( ! this . _isGestureMoved ) {
299299 return ;
@@ -330,7 +330,7 @@ var Image = /** @class */ (function (_super) {
330330 } ) . start ( ) ;
331331 }
332332 } ;
333- Image . getDerivedStateFromProps = function ( nextProps , prevState ) {
333+ ImageComponent . getDerivedStateFromProps = function ( nextProps , prevState ) {
334334 if ( prevState . width === null || prevState . height === null ) {
335335 var resolveSource = RNImage . resolveAssetSource ( nextProps . source ) ;
336336 return {
@@ -340,7 +340,7 @@ var Image = /** @class */ (function (_super) {
340340 }
341341 return null ;
342342 } ;
343- Image . prototype . componentDidMount = function ( ) {
343+ ImageComponent . prototype . componentDidMount = function ( ) {
344344 var _this = this ;
345345 if ( ! this . state . width || ! this . state . height ) {
346346 this . _debug ( 'Image' , 'fetch image size with headers' , this . props . source ) ;
@@ -350,7 +350,7 @@ var Image = /** @class */ (function (_super) {
350350 } ) ;
351351 }
352352 } ;
353- Image . prototype . render = function ( ) {
353+ ImageComponent . prototype . render = function ( ) {
354354 var moveObjStyle = {
355355 position : 'absolute' ,
356356 transform : __spreadArray ( __spreadArray ( [ ] , this . _translateXY . getTranslateTransform ( ) , true ) , [
@@ -394,13 +394,13 @@ var Image = /** @class */ (function (_super) {
394394 </ SafeAreaView >
395395 </ View > ) ;
396396 } ;
397- Image . defaultProps = {
397+ ImageComponent . defaultProps = {
398398 initialWidth : 200 ,
399399 initialHeight : 200 ,
400400 debug : false ,
401401 renderFooter : undefined ,
402402 } ;
403- return Image ;
403+ return ImageComponent ;
404404} ( React . Component ) ) ;
405405var styles = StyleSheet . create ( {
406406 container : {
@@ -433,4 +433,5 @@ var styles = StyleSheet.create({
433433 borderRadius : 10 ,
434434 } ,
435435} ) ;
436+ var Image = gestureHandlerRootHOC ( function ( props ) { return < ImageComponent { ...props } /> ; } ) ;
436437export default Image ;
0 commit comments