react-native-fast-image 9.3.6 → 9.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -780,13 +780,15 @@ class FastImageViewWithUrl extends AppCompatImageView implements ReactPointerEve
|
|
|
780
780
|
private ScaleType mLayoutScaleType = ScaleType.FIT_CENTER;
|
|
781
781
|
|
|
782
782
|
// Glide crops or fits the bitmap for the scale type when it loads, so a
|
|
783
|
-
// new resizeMode needs a reload to take effect (#762)
|
|
783
|
+
// new resizeMode needs a reload to take effect (#762): the image that's
|
|
784
|
+
// showing, loaded again quietly (see reblur), as for a new blurRadius,
|
|
785
|
+
// without the load events, as on iOS.
|
|
784
786
|
public void setResizeMode(ScaleType scaleType, boolean repeat, boolean inPixels) {
|
|
785
787
|
if (scaleType == mResizeScaleType && repeat == mRepeat && inPixels == mInPixels) return;
|
|
786
788
|
mResizeScaleType = scaleType;
|
|
787
789
|
mInPixels = inPixels;
|
|
788
790
|
mRepeat = repeat;
|
|
789
|
-
|
|
791
|
+
mFitChanged = true;
|
|
790
792
|
// A loaded image on screen was cropped or fitted for the old scale
|
|
791
793
|
// type: it keeps its layout until the image for the new one is ready
|
|
792
794
|
// (onImageLoaded), or the load fails. Laid out for the new one, a
|
|
@@ -946,6 +948,8 @@ class FastImageViewWithUrl extends AppCompatImageView implements ReactPointerEve
|
|
|
946
948
|
// reblur for a change).
|
|
947
949
|
private float mBlurRadius = 0;
|
|
948
950
|
private boolean mBlurChanged = false;
|
|
951
|
+
// resizeMode or objectFit changed (setResizeMode).
|
|
952
|
+
private boolean mFitChanged = false;
|
|
949
953
|
|
|
950
954
|
public void setBlurRadius(float blurRadius) {
|
|
951
955
|
if (blurRadius == mBlurRadius) return;
|
|
@@ -1123,10 +1127,11 @@ class FastImageViewWithUrl extends AppCompatImageView implements ReactPointerEve
|
|
|
1123
1127
|
into(shown, builder, meanwhile, true);
|
|
1124
1128
|
}
|
|
1125
1129
|
|
|
1126
|
-
// blurRadius changed, and nothing else that needs a reload:
|
|
1127
|
-
// that's showing, blurred again, with no events, as
|
|
1128
|
-
// decoded again from the cache and blurred
|
|
1129
|
-
//
|
|
1130
|
+
// blurRadius or resizeMode changed, and nothing else that needs a reload:
|
|
1131
|
+
// the image that's showing, blurred or fitted again, with no events, as
|
|
1132
|
+
// reloadForSize does: it's decoded again from the cache and blurred or
|
|
1133
|
+
// fitted on Glide's threads, and the view keeps the current image (and its
|
|
1134
|
+
// layout, see onImageLoaded) until then. If that fails, it shows the image
|
|
1130
1135
|
// from Glide's caches; cache: 'web' skips them, so the view shows
|
|
1131
1136
|
// defaultSource (or nothing) then. Also while it's loading again that way
|
|
1132
1137
|
// (e.g. the blur changes every frame): that load is replaced. A load that
|
|
@@ -1240,8 +1245,9 @@ class FastImageViewWithUrl extends AppCompatImageView implements ReactPointerEve
|
|
|
1240
1245
|
@Nullable RequestManager requestManager) {
|
|
1241
1246
|
if (mDropped) return;
|
|
1242
1247
|
mManager = manager;
|
|
1243
|
-
if (mBlurChanged && !mNeedsReload) {
|
|
1248
|
+
if ((mBlurChanged || mFitChanged) && !mNeedsReload) {
|
|
1244
1249
|
mBlurChanged = false;
|
|
1250
|
+
mFitChanged = false;
|
|
1245
1251
|
reblur();
|
|
1246
1252
|
}
|
|
1247
1253
|
if (!mNeedsReload)
|
|
@@ -1272,6 +1278,7 @@ class FastImageViewWithUrl extends AppCompatImageView implements ReactPointerEve
|
|
|
1272
1278
|
// defaultSource, resizeMode), not for every prop update.
|
|
1273
1279
|
mNeedsReload = false;
|
|
1274
1280
|
mBlurChanged = false;
|
|
1281
|
+
mFitChanged = false;
|
|
1275
1282
|
boolean switching = mSwitchesSource;
|
|
1276
1283
|
mSwitchesSource = false;
|
|
1277
1284
|
boolean restarting = mRestarting;
|