react-native-fast-image 8.13.1 → 8.14.0
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.
- package/README.md +25 -0
- package/android/src/main/java/com/dylanvann/fastimage/FastImageViewWithUrl.java +3 -2
- package/dist/index.cjs.js +26 -1
- package/dist/index.cjs.js.flow +9 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +21 -1
- package/dist/index.js.flow +9 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -265,6 +265,31 @@ In this case the image will still be styled and laid out the same way as `FastIm
|
|
|
265
265
|
|
|
266
266
|
If supplied, changes the color of all the non-transparent pixels to the given color.
|
|
267
267
|
|
|
268
|
+
## `FastImageBackground`
|
|
269
|
+
|
|
270
|
+
An image with content on top of it, like React Native's `ImageBackground`: a view that the image fills, with the children on top.
|
|
271
|
+
|
|
272
|
+
Use it rather than giving `FastImage` children: in the next major version, `FastImage` won't render children, since the image will be a single native view ([#1137](https://github.com/DylanVann/react-native-fast-image/pull/1137)), which can't hold them. `FastImageBackground` works the same in both.
|
|
273
|
+
|
|
274
|
+
```jsx
|
|
275
|
+
import { FastImageBackground } from 'react-native-fast-image'
|
|
276
|
+
|
|
277
|
+
const Banner = () => (
|
|
278
|
+
<FastImageBackground
|
|
279
|
+
source={{ uri: 'https://unsplash.it/400/200?image=1' }}
|
|
280
|
+
style={{ width: 200, height: 100 }}
|
|
281
|
+
imageStyle={{ borderRadius: 8 }}
|
|
282
|
+
>
|
|
283
|
+
<Text>On top of the image</Text>
|
|
284
|
+
</FastImageBackground>
|
|
285
|
+
)
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
- `style`: the view's style (it sizes the view, which the image fills).
|
|
289
|
+
- `imageStyle`: the image's style.
|
|
290
|
+
- `imageRef`: a ref to the image.
|
|
291
|
+
- The other props are `FastImage`'s, for the image.
|
|
292
|
+
|
|
268
293
|
## Static Methods
|
|
269
294
|
|
|
270
295
|
### `FastImage.preload: (source[]) => Promise<result[]>`
|
|
@@ -18,7 +18,6 @@ import com.bumptech.glide.RequestManager;
|
|
|
18
18
|
import com.bumptech.glide.load.model.GlideUrl;
|
|
19
19
|
import com.bumptech.glide.load.resource.bitmap.DownsampleStrategy;
|
|
20
20
|
import com.bumptech.glide.load.resource.gif.GifDrawable;
|
|
21
|
-
import com.bumptech.glide.request.Request;
|
|
22
21
|
import com.bumptech.glide.request.RequestOptions;
|
|
23
22
|
import com.bumptech.glide.request.target.DrawableImageViewTarget;
|
|
24
23
|
import com.bumptech.glide.request.target.SizeReadyCallback;
|
|
@@ -472,7 +471,9 @@ class FastImageViewWithUrl extends AppCompatImageView {
|
|
|
472
471
|
}
|
|
473
472
|
|
|
474
473
|
public void clearView(@Nullable RequestManager requestManager) {
|
|
475
|
-
|
|
474
|
+
// Glide keeps the view's request under its own tag id, not getTag().
|
|
475
|
+
// Without a request this does nothing.
|
|
476
|
+
if (requestManager != null) {
|
|
476
477
|
requestManager.clear(this);
|
|
477
478
|
}
|
|
478
479
|
}
|
package/dist/index.cjs.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
+
});
|
|
1
5
|
//#region \0rolldown/runtime.js
|
|
2
6
|
var __create = Object.create;
|
|
3
7
|
var __defProp = Object.defineProperty;
|
|
@@ -169,6 +173,26 @@ const styles = react_native.StyleSheet.create({
|
|
|
169
173
|
},
|
|
170
174
|
imageContainer: { overflow: "hidden" }
|
|
171
175
|
});
|
|
176
|
+
const FastImageWithRef = FastImageComponent;
|
|
177
|
+
/**
|
|
178
|
+
* An image with content on top of it, like React Native's `ImageBackground`: a
|
|
179
|
+
* view that the image fills, with the children on top. Use it rather than
|
|
180
|
+
* giving `FastImage` children, which it won't render in the next major version
|
|
181
|
+
* (the image will be a single native view). The other props go to the image;
|
|
182
|
+
* the ref is the view's.
|
|
183
|
+
*/
|
|
184
|
+
const FastImageBackground = (0, react.forwardRef)(({ style, imageStyle, imageRef, children, importantForAccessibility, ...props }, ref) => /* @__PURE__ */ react.default.createElement(react_native.View, {
|
|
185
|
+
accessibilityIgnoresInvertColors: true,
|
|
186
|
+
importantForAccessibility,
|
|
187
|
+
style,
|
|
188
|
+
ref
|
|
189
|
+
}, /* @__PURE__ */ react.default.createElement(FastImageWithRef, {
|
|
190
|
+
...props,
|
|
191
|
+
importantForAccessibility,
|
|
192
|
+
style: [react_native.StyleSheet.absoluteFill, imageStyle],
|
|
193
|
+
ref: imageRef
|
|
194
|
+
}), children));
|
|
195
|
+
FastImageBackground.displayName = "FastImageBackground";
|
|
172
196
|
const FastImageView = (0, react_native.requireNativeComponent)("FastImageView", FastImage, { nativeOnly: {
|
|
173
197
|
onFastImageLoadStart: true,
|
|
174
198
|
onFastImageProgress: true,
|
|
@@ -177,4 +201,5 @@ const FastImageView = (0, react_native.requireNativeComponent)("FastImageView",
|
|
|
177
201
|
onFastImageLoadEnd: true
|
|
178
202
|
} });
|
|
179
203
|
//#endregion
|
|
180
|
-
|
|
204
|
+
exports.FastImageBackground = FastImageBackground;
|
|
205
|
+
exports.default = FastImage;
|
package/dist/index.cjs.js.flow
CHANGED
|
@@ -96,6 +96,15 @@ export type FastImageProps = $ReadOnly<{|
|
|
|
96
96
|
testID?: ?string,
|
|
97
97
|
|}>
|
|
98
98
|
|
|
99
|
+
export type FastImageBackgroundProps = $ReadOnly<{|
|
|
100
|
+
...FastImageProps,
|
|
101
|
+
imageStyle?: $PropertyType<ViewProps, 'style'>,
|
|
102
|
+
imageRef?: React$Ref<any>,
|
|
103
|
+
children?: React$Node,
|
|
104
|
+
|}>
|
|
105
|
+
|
|
106
|
+
declare export var FastImageBackground: React$ComponentType<FastImageBackgroundProps>
|
|
107
|
+
|
|
99
108
|
declare export default class FastImage extends React$Component<FastImageProps> {
|
|
100
109
|
static resizeMode: ResizeMode;
|
|
101
110
|
static priority: Priority;
|
package/dist/index.d.ts
CHANGED
|
@@ -155,4 +155,22 @@ export interface FastImageStaticProperties {
|
|
|
155
155
|
clearDiskCache: () => Promise<void>;
|
|
156
156
|
}
|
|
157
157
|
declare const FastImage: React.ComponentType<FastImageProps> & FastImageStaticProperties;
|
|
158
|
+
export interface FastImageBackgroundProps extends Omit<FastImageProps, 'style' | 'children'> {
|
|
159
|
+
/** The container's style; the image fills it. */
|
|
160
|
+
style?: StyleProp<ViewStyle>;
|
|
161
|
+
/** The image's style. */
|
|
162
|
+
imageStyle?: StyleProp<ImageStyle>;
|
|
163
|
+
/** A ref to the image (the FastImage inside). */
|
|
164
|
+
imageRef?: React.Ref<any>;
|
|
165
|
+
/** Content shown on top of the image. */
|
|
166
|
+
children?: React.ReactNode;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* An image with content on top of it, like React Native's `ImageBackground`: a
|
|
170
|
+
* view that the image fills, with the children on top. Use it rather than
|
|
171
|
+
* giving `FastImage` children, which it won't render in the next major version
|
|
172
|
+
* (the image will be a single native view). The other props go to the image;
|
|
173
|
+
* the ref is the view's.
|
|
174
|
+
*/
|
|
175
|
+
export declare const FastImageBackground: React.ComponentType<FastImageBackgroundProps>;
|
|
158
176
|
export default FastImage;
|
package/dist/index.js
CHANGED
|
@@ -146,6 +146,26 @@ const styles = StyleSheet.create({
|
|
|
146
146
|
},
|
|
147
147
|
imageContainer: { overflow: "hidden" }
|
|
148
148
|
});
|
|
149
|
+
const FastImageWithRef = FastImageComponent;
|
|
150
|
+
/**
|
|
151
|
+
* An image with content on top of it, like React Native's `ImageBackground`: a
|
|
152
|
+
* view that the image fills, with the children on top. Use it rather than
|
|
153
|
+
* giving `FastImage` children, which it won't render in the next major version
|
|
154
|
+
* (the image will be a single native view). The other props go to the image;
|
|
155
|
+
* the ref is the view's.
|
|
156
|
+
*/
|
|
157
|
+
const FastImageBackground = forwardRef(({ style, imageStyle, imageRef, children, importantForAccessibility, ...props }, ref) => /* @__PURE__ */ React.createElement(View, {
|
|
158
|
+
accessibilityIgnoresInvertColors: true,
|
|
159
|
+
importantForAccessibility,
|
|
160
|
+
style,
|
|
161
|
+
ref
|
|
162
|
+
}, /* @__PURE__ */ React.createElement(FastImageWithRef, {
|
|
163
|
+
...props,
|
|
164
|
+
importantForAccessibility,
|
|
165
|
+
style: [StyleSheet.absoluteFill, imageStyle],
|
|
166
|
+
ref: imageRef
|
|
167
|
+
}), children));
|
|
168
|
+
FastImageBackground.displayName = "FastImageBackground";
|
|
149
169
|
const FastImageView = requireNativeComponent("FastImageView", FastImage, { nativeOnly: {
|
|
150
170
|
onFastImageLoadStart: true,
|
|
151
171
|
onFastImageProgress: true,
|
|
@@ -154,4 +174,4 @@ const FastImageView = requireNativeComponent("FastImageView", FastImage, { nativ
|
|
|
154
174
|
onFastImageLoadEnd: true
|
|
155
175
|
} });
|
|
156
176
|
//#endregion
|
|
157
|
-
export { FastImage as default };
|
|
177
|
+
export { FastImageBackground, FastImage as default };
|
package/dist/index.js.flow
CHANGED
|
@@ -96,6 +96,15 @@ export type FastImageProps = $ReadOnly<{|
|
|
|
96
96
|
testID?: ?string,
|
|
97
97
|
|}>
|
|
98
98
|
|
|
99
|
+
export type FastImageBackgroundProps = $ReadOnly<{|
|
|
100
|
+
...FastImageProps,
|
|
101
|
+
imageStyle?: $PropertyType<ViewProps, 'style'>,
|
|
102
|
+
imageRef?: React$Ref<any>,
|
|
103
|
+
children?: React$Node,
|
|
104
|
+
|}>
|
|
105
|
+
|
|
106
|
+
declare export var FastImageBackground: React$ComponentType<FastImageBackgroundProps>
|
|
107
|
+
|
|
99
108
|
declare export default class FastImage extends React$Component<FastImageProps> {
|
|
100
109
|
static resizeMode: ResizeMode;
|
|
101
110
|
static priority: Priority;
|