react-native-fast-image 8.6.23 → 8.6.24

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.
@@ -1,6 +1,7 @@
1
1
  package com.dylanvann.fastimage;
2
2
 
3
3
  import static com.dylanvann.fastimage.FastImageRequestListener.REACT_ON_ERROR_EVENT;
4
+ import static com.dylanvann.fastimage.FastImageRequestListener.REACT_ON_LOAD_END_EVENT;
4
5
 
5
6
  import android.annotation.SuppressLint;
6
7
  import android.content.Context;
@@ -55,8 +56,8 @@ class FastImageViewWithUrl extends AppCompatImageView {
55
56
  if (!mNeedsReload)
56
57
  return;
57
58
 
58
- if (!FastImageViewConverter.hasUri(mSource) && mDefaultSource == null) {
59
-
59
+ // Nothing to show.
60
+ if (mSource == null && mDefaultSource == null) {
60
61
  // Cancel existing requests.
61
62
  clearView(requestManager);
62
63
 
@@ -70,9 +71,14 @@ class FastImageViewWithUrl extends AppCompatImageView {
70
71
  }
71
72
 
72
73
  //final GlideUrl glideUrl = FastImageViewConverter.getGlideUrl(view.getContext(), mSource);
73
- final FastImageSource imageSource = FastImageViewConverter.getImageSource(getContext(), mSource);
74
-
75
- if (imageSource != null && imageSource.getUri().toString().length() == 0) {
74
+ final FastImageSource imageSource = FastImageViewConverter.hasUri(mSource)
75
+ ? FastImageViewConverter.getImageSource(getContext(), mSource)
76
+ : null;
77
+
78
+ // A source without a uri (empty, missing or null), or one that can't be
79
+ // resolved: fire onError and onLoadEnd and show defaultSource, as on iOS
80
+ // (#1028, #945).
81
+ if (mSource != null && (imageSource == null || imageSource.getUri().toString().length() == 0)) {
76
82
  ReactContext context = FastImageViewManager.getReactContext(getContext());
77
83
  if (context != null) {
78
84
  RCTEventEmitter eventEmitter = context.getJSModule(RCTEventEmitter.class);
@@ -80,6 +86,7 @@ class FastImageViewWithUrl extends AppCompatImageView {
80
86
  WritableMap event = new WritableNativeMap();
81
87
  event.putString("message", "Invalid source prop:" + mSource);
82
88
  eventEmitter.receiveEvent(viewId, REACT_ON_ERROR_EVENT, event);
89
+ eventEmitter.receiveEvent(viewId, REACT_ON_LOAD_END_EVENT, new WritableNativeMap());
83
90
  }
84
91
 
85
92
  // Cancel existing requests.
@@ -88,8 +95,7 @@ class FastImageViewWithUrl extends AppCompatImageView {
88
95
  if (glideUrl != null) {
89
96
  FastImageOkHttpProgressGlideModule.forget(glideUrl.toStringUrl());
90
97
  }
91
- // Clear the image.
92
- setImageDrawable(null);
98
+ setImageDrawable(mDefaultSource);
93
99
  return;
94
100
  }
95
101
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-fast-image",
3
- "version": "8.6.23",
3
+ "version": "8.6.24",
4
4
  "description": "🚩 FastImage, performant React Native image component.",
5
5
  "keywords": [
6
6
  "cache",