react-native-fast-image 8.6.38 → 8.6.39

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.
@@ -140,7 +140,10 @@ public class FastImageOkHttpProgressGlideModule extends LibraryGlideModule {
140
140
  @Override
141
141
  public void update(final String key, final long bytesRead, final long contentLength) {
142
142
  final FastImageProgressListener listener = LISTENERS.get(key);
143
- if (listener == null) {
143
+ // Without a Content-Length the total is unknown (-1), and a
144
+ // percentage can't be worked out from it, so don't send those. (It
145
+ // also looked like the last update, which stopped all updates.)
146
+ if (listener == null || contentLength <= 0) {
144
147
  return;
145
148
  }
146
149
  if (contentLength <= bytesRead) {
@@ -247,6 +247,11 @@
247
247
  SDImageLoaderProgressBlock progress = nil;
248
248
  if (self.onFastImageProgress) {
249
249
  progress = ^(NSInteger receivedSize, NSInteger expectedSize, NSURL* _Nullable targetURL) {
250
+ // Without a Content-Length the total is unknown (-1 or 0), and a
251
+ // percentage can't be worked out from it, so don't send those.
252
+ if (expectedSize <= 0) {
253
+ return;
254
+ }
250
255
  // SDWebImage calls this on its download queue, while React Native
251
256
  // sets onFastImageProgress (and deallocates the view) on the main
252
257
  // queue. Read and call it there, so it can't change or be released
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-fast-image",
3
- "version": "8.6.38",
3
+ "version": "8.6.39",
4
4
  "description": "🚩 FastImage, performant React Native image component.",
5
5
  "keywords": [
6
6
  "cache",