alwx / react-native-photo-view

Pinch-to-zoom view for React Native (both iOS and Android)
MIT License
815 stars 434 forks source link

Default image is rotating before actual image loads completely #190

Open manjeets12 opened 4 years ago

manjeets12 commented 4 years ago

"react-native": "^0.59.5" "react-native-photo-view": "^1.5.2"

imageLoadError =()=>{
}
 <PhotoView
          loadingIndicatorSource={require(PATH_TO_LOCALE_IMAGE)}
          source={{ uri: IMAGE_URL }}
          minimumZoomScale={0.95}
          maximumZoomScale={4}
          scale={5}
          androidScaleType="fitCenter"
          // onLoad={() => console.log('Image loaded!')}
          onError={this.imageLoadError}
          style={styles.image}
        />

Everything looks fine in debug mode but in android release build default image keep rotating until actual image loads.

actually following code seems to be reason for that, It will be great if there is some options to disable that default rotation animation

    public void setLoadingIndicatorSource(@Nullable String name,
                                          ResourceDrawableIdHelper resourceDrawableIdHelper) {
        Drawable drawable = resourceDrawableIdHelper.getResourceDrawable(getContext(), name);
        mLoadingImageDrawable =
                drawable != null ? (Drawable) new AutoRotateDrawable(drawable, 1000) : null;
        mIsDirty = true;
    }