ascoders / react-native-image-zoom

react native image pan and zoom
MIT License
639 stars 282 forks source link

ImageZoom move image down and only show a portion #142

Open emclab opened 4 years ago

emclab commented 4 years ago

My RN app is 0.62.2, ImageZoom is 2.1.12. The ImageZoom is going to zoom in images presented in Android emulator with FastImage. Here is the code:

      return (
            <ImageZoom  
                        cropWidth={screen_width}   //<<<===full screen width returned by Dimension.get(window).width
                        cropHeight={screen_ht}   //<<<===full screen height returned by Dimension.get(window).height
                        imageWidth={width}
                        imageHeight={ht}
                        enableCenterFocus={false}
                        >
                <FastImage 
                    source={{uri:img_source}} 
                    resizeMode={FastImage.resizeMode.cover} 
                    style={{
                        width:width, 
                        height:ht, 
                        verticalAlign:0,
                        paddingTop:0,
                    }}
                />
            </ImageZoom>
            );

The problem is that the image showed was pushed down half way and only show a portion. Capture1

But when ImageZoom was removed and only show with FastImage, then the image aligns to the top which is correct. I tried to set enableCenterFocus to false but it didn't help. The same problem exists with <View> of RN.

emclab commented 4 years ago

More information about the issue is available here