react-native-fast-image 8.5.9 → 8.5.12

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.
@@ -9,6 +9,7 @@ import android.os.Build;
9
9
  import com.bumptech.glide.Glide;
10
10
  import com.bumptech.glide.RequestManager;
11
11
  import com.bumptech.glide.load.model.GlideUrl;
12
+ import com.bumptech.glide.request.Request;
12
13
  import com.facebook.react.bridge.ReadableMap;
13
14
  import com.facebook.react.bridge.WritableMap;
14
15
  import com.facebook.react.bridge.WritableNativeMap;
@@ -58,9 +59,7 @@ class FastImageViewManager extends SimpleViewManager<FastImageViewWithUrl> imple
58
59
  public void setSrc(FastImageViewWithUrl view, @Nullable ReadableMap source) {
59
60
  if (source == null || !source.hasKey("uri") || isNullOrEmpty(source.getString("uri"))) {
60
61
  // Cancel existing requests.
61
- if (requestManager != null) {
62
- requestManager.clear(view);
63
- }
62
+ clearView(view);
64
63
 
65
64
  if (view.glideUrl != null) {
66
65
  FastImageOkHttpProgressGlideModule.forget(view.glideUrl.toStringUrl());
@@ -97,9 +96,7 @@ class FastImageViewManager extends SimpleViewManager<FastImageViewWithUrl> imple
97
96
 
98
97
  // Cancel existing request.
99
98
  view.glideUrl = glideUrl;
100
- if (requestManager != null) {
101
- requestManager.clear(view);
102
- }
99
+ clearView(view);
103
100
 
104
101
  String key = glideUrl.toStringUrl();
105
102
  FastImageOkHttpProgressGlideModule.expect(key, this);
@@ -149,9 +146,7 @@ class FastImageViewManager extends SimpleViewManager<FastImageViewWithUrl> imple
149
146
  @Override
150
147
  public void onDropViewInstance(FastImageViewWithUrl view) {
151
148
  // This will cancel existing requests.
152
- if (requestManager != null) {
153
- requestManager.clear(view);
154
- }
149
+ clearView(view);
155
150
 
156
151
  if (view.glideUrl != null) {
157
152
  final String key = view.glideUrl.toString();
@@ -244,4 +239,10 @@ class FastImageViewManager extends SimpleViewManager<FastImageViewWithUrl> imple
244
239
  }
245
240
 
246
241
  }
242
+
243
+ private void clearView(FastImageViewWithUrl view) {
244
+ if (requestManager != null && view != null && view.getTag() != null && view.getTag() instanceof Request) {
245
+ requestManager.clear(view);
246
+ }
247
+ }
247
248
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-fast-image",
3
- "version": "8.5.9",
3
+ "version": "8.5.12",
4
4
  "description": "🚩 FastImage, performant React Native image component.",
5
5
  "keywords": [
6
6
  "cache",
@@ -76,7 +76,7 @@
76
76
  "typescript": "^4.3.5"
77
77
  },
78
78
  "peerDependencies": {
79
- "react": "^16.8.6 || ^17.0.0",
79
+ "react": "^17 || ^18",
80
80
  "react-native": ">=0.60.0"
81
81
  }
82
82
  }