react-native-fast-image 8.6.14 → 8.6.16
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 android.app.Activity;
|
|
4
|
+
import android.util.Log;
|
|
4
5
|
|
|
5
6
|
import androidx.annotation.NonNull;
|
|
6
7
|
|
|
@@ -17,6 +18,7 @@ import com.facebook.react.views.imagehelper.ImageSource;
|
|
|
17
18
|
class FastImageViewModule extends ReactContextBaseJavaModule {
|
|
18
19
|
|
|
19
20
|
private static final String REACT_CLASS = "FastImageView";
|
|
21
|
+
private static final String TAG = "FastImage";
|
|
20
22
|
|
|
21
23
|
FastImageViewModule(ReactApplicationContext reactContext) {
|
|
22
24
|
super(reactContext);
|
|
@@ -38,8 +40,18 @@ class FastImageViewModule extends ReactContextBaseJavaModule {
|
|
|
38
40
|
for (int i = 0; i < sources.size(); i++) {
|
|
39
41
|
final ReadableMap source = sources.getMap(i);
|
|
40
42
|
// Skip sources without a uri (Glide throws on an empty url).
|
|
41
|
-
|
|
43
|
+
// preload has no way to report errors, so log them.
|
|
44
|
+
if (!FastImageViewConverter.hasUri(source)) {
|
|
45
|
+
Log.w(TAG, "preload: skipping a source without a uri");
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
42
48
|
final FastImageSource imageSource = FastImageViewConverter.getImageSource(activity, source);
|
|
49
|
+
// Also skip a uri that can't be resolved (e.g. a relative path),
|
|
50
|
+
// which resolves to an empty one. The view reports it as an error.
|
|
51
|
+
if (imageSource.getUri().toString().isEmpty()) {
|
|
52
|
+
Log.w(TAG, "preload: skipping a uri that can't be resolved: " + source.getString("uri"));
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
43
55
|
|
|
44
56
|
Glide
|
|
45
57
|
.with(activity.getApplicationContext())
|
package/dist/index.cjs.js
CHANGED
|
@@ -68,18 +68,31 @@ function FastImageBase({
|
|
|
68
68
|
// On the wrapper, so the layout is relative to the parent (the image view
|
|
69
69
|
// inside always has x and y of 0).
|
|
70
70
|
onLayout,
|
|
71
|
-
...
|
|
71
|
+
...viewProps
|
|
72
72
|
}) {
|
|
73
|
+
// Touchables pass onClick to their child (React Native 0.73+, for
|
|
74
|
+
// accessibility clicks). It goes on the wrapper: the image view doesn't
|
|
75
|
+
// support it on iOS, which crashed (#1020). Older React Native types don't
|
|
76
|
+
// include it.
|
|
77
|
+
const {
|
|
78
|
+
onClick,
|
|
79
|
+
...props
|
|
80
|
+
} = viewProps;
|
|
81
|
+
const wrapperProps = {
|
|
82
|
+
onLayout,
|
|
83
|
+
onClick
|
|
84
|
+
};
|
|
85
|
+
|
|
73
86
|
if (fallback) {
|
|
74
87
|
const cleanedSource = { ...source
|
|
75
88
|
};
|
|
76
89
|
delete cleanedSource.cache;
|
|
77
90
|
const resolvedSource = reactNative.Image.resolveAssetSource(cleanedSource);
|
|
78
|
-
return /*#__PURE__*/React__default['default'].createElement(reactNative.View, {
|
|
79
|
-
style: [styles.imageContainer, style]
|
|
80
|
-
|
|
91
|
+
return /*#__PURE__*/React__default['default'].createElement(reactNative.View, _extends__default['default']({
|
|
92
|
+
style: [styles.imageContainer, style]
|
|
93
|
+
}, wrapperProps, {
|
|
81
94
|
ref: forwardedRef
|
|
82
|
-
}, /*#__PURE__*/React__default['default'].createElement(reactNative.Image, _extends__default['default']({}, props, {
|
|
95
|
+
}), /*#__PURE__*/React__default['default'].createElement(reactNative.Image, _extends__default['default']({}, props, {
|
|
83
96
|
style: [reactNative.StyleSheet.absoluteFill, {
|
|
84
97
|
tintColor
|
|
85
98
|
}],
|
|
@@ -96,11 +109,11 @@ function FastImageBase({
|
|
|
96
109
|
|
|
97
110
|
const resolvedSource = reactNative.Image.resolveAssetSource(source);
|
|
98
111
|
const resolvedDefaultSource = resolveDefaultSource(defaultSource);
|
|
99
|
-
return /*#__PURE__*/React__default['default'].createElement(reactNative.View, {
|
|
100
|
-
style: [styles.imageContainer, style]
|
|
101
|
-
|
|
112
|
+
return /*#__PURE__*/React__default['default'].createElement(reactNative.View, _extends__default['default']({
|
|
113
|
+
style: [styles.imageContainer, style]
|
|
114
|
+
}, wrapperProps, {
|
|
102
115
|
ref: forwardedRef
|
|
103
|
-
}, /*#__PURE__*/React__default['default'].createElement(FastImageView, _extends__default['default']({}, props, {
|
|
116
|
+
}), /*#__PURE__*/React__default['default'].createElement(FastImageView, _extends__default['default']({}, props, {
|
|
104
117
|
tintColor: tintColor,
|
|
105
118
|
style: reactNative.StyleSheet.absoluteFill,
|
|
106
119
|
source: resolvedSource,
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA2B,MAAM,OAAO,CAAA;AAC/C,OAAO,EAMH,iBAAiB,EACjB,SAAS,EACT,SAAS,EACT,kBAAkB,EAElB,kBAAkB,EAClB,SAAS,EACT,UAAU,EACb,MAAM,cAAc,CAAA;AAErB,oBAAY,UAAU,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,QAAQ,CAAA;AAEnE,QAAA,MAAM,UAAU;;;;;CAKN,CAAA;AAEV,oBAAY,QAAQ,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAA;AAEhD,QAAA,MAAM,QAAQ;;;;CAIJ,CAAA;AAEV,oBAAY,KAAK,GAAG,WAAW,GAAG,KAAK,GAAG,WAAW,CAAA;AAErD,QAAA,MAAM,YAAY;;;;CAOR,CAAA;AAEV,oBAAY,MAAM,GAAG;IACjB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAA;IACnC,QAAQ,CAAC,EAAE,QAAQ,CAAA;IACnB,KAAK,CAAC,EAAE,KAAK,CAAA;CAChB,CAAA;AAED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EtB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IAEf;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAC7B;AAsHD,MAAM,WAAW,yBAAyB;IACtC,UAAU,EAAE,OAAO,UAAU,CAAA;IAC7B,QAAQ,EAAE,OAAO,QAAQ,CAAA;IACzB,YAAY,EAAE,OAAO,YAAY,CAAA;IACjC,OAAO,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,IAAI,CAAA;IACpC,gBAAgB,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IACrC,cAAc,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CACtC;AAED,QAAA,MAAM,SAAS,EAAE,KAAK,CAAC,aAAa,CAAC,cAAc,CAAC,GAChD,yBAAqD,CAAA;AAqCzD,eAAe,SAAS,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -61,18 +61,31 @@ function FastImageBase({
|
|
|
61
61
|
// On the wrapper, so the layout is relative to the parent (the image view
|
|
62
62
|
// inside always has x and y of 0).
|
|
63
63
|
onLayout,
|
|
64
|
-
...
|
|
64
|
+
...viewProps
|
|
65
65
|
}) {
|
|
66
|
+
// Touchables pass onClick to their child (React Native 0.73+, for
|
|
67
|
+
// accessibility clicks). It goes on the wrapper: the image view doesn't
|
|
68
|
+
// support it on iOS, which crashed (#1020). Older React Native types don't
|
|
69
|
+
// include it.
|
|
70
|
+
const {
|
|
71
|
+
onClick,
|
|
72
|
+
...props
|
|
73
|
+
} = viewProps;
|
|
74
|
+
const wrapperProps = {
|
|
75
|
+
onLayout,
|
|
76
|
+
onClick
|
|
77
|
+
};
|
|
78
|
+
|
|
66
79
|
if (fallback) {
|
|
67
80
|
const cleanedSource = { ...source
|
|
68
81
|
};
|
|
69
82
|
delete cleanedSource.cache;
|
|
70
83
|
const resolvedSource = Image.resolveAssetSource(cleanedSource);
|
|
71
|
-
return /*#__PURE__*/React.createElement(View, {
|
|
72
|
-
style: [styles.imageContainer, style]
|
|
73
|
-
|
|
84
|
+
return /*#__PURE__*/React.createElement(View, _extends({
|
|
85
|
+
style: [styles.imageContainer, style]
|
|
86
|
+
}, wrapperProps, {
|
|
74
87
|
ref: forwardedRef
|
|
75
|
-
}, /*#__PURE__*/React.createElement(Image, _extends({}, props, {
|
|
88
|
+
}), /*#__PURE__*/React.createElement(Image, _extends({}, props, {
|
|
76
89
|
style: [StyleSheet.absoluteFill, {
|
|
77
90
|
tintColor
|
|
78
91
|
}],
|
|
@@ -89,11 +102,11 @@ function FastImageBase({
|
|
|
89
102
|
|
|
90
103
|
const resolvedSource = Image.resolveAssetSource(source);
|
|
91
104
|
const resolvedDefaultSource = resolveDefaultSource(defaultSource);
|
|
92
|
-
return /*#__PURE__*/React.createElement(View, {
|
|
93
|
-
style: [styles.imageContainer, style]
|
|
94
|
-
|
|
105
|
+
return /*#__PURE__*/React.createElement(View, _extends({
|
|
106
|
+
style: [styles.imageContainer, style]
|
|
107
|
+
}, wrapperProps, {
|
|
95
108
|
ref: forwardedRef
|
|
96
|
-
}, /*#__PURE__*/React.createElement(FastImageView, _extends({}, props, {
|
|
109
|
+
}), /*#__PURE__*/React.createElement(FastImageView, _extends({}, props, {
|
|
97
110
|
tintColor: tintColor,
|
|
98
111
|
style: StyleSheet.absoluteFill,
|
|
99
112
|
source: resolvedSource,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#import "FFFastImageViewManager.h"
|
|
2
2
|
#import "FFFastImageView.h"
|
|
3
|
+
#import <React/RCTLog.h>
|
|
3
4
|
|
|
4
5
|
#import <SDWebImage/SDImageCache.h>
|
|
5
6
|
#import <SDWebImage/SDWebImagePrefetcher.h>
|
|
@@ -30,6 +31,8 @@ RCT_EXPORT_METHOD(preload:(nonnull NSArray<FFFastImageSource *> *)sources)
|
|
|
30
31
|
// Skip sources without a url (an empty, missing or null uri). NSArray can't
|
|
31
32
|
// hold nil, so adding one throws and crashes the app.
|
|
32
33
|
if (!source.url) {
|
|
34
|
+
// preload has no way to report errors, so log it.
|
|
35
|
+
RCTLogWarn(@"FastImage.preload: skipping a source without a valid uri");
|
|
33
36
|
return;
|
|
34
37
|
}
|
|
35
38
|
[source.headers enumerateKeysAndObjectsUsingBlock:^(NSString *key, NSString* header, BOOL *stop) {
|