react-native-fast-image 8.27.0 → 8.27.1

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 CHANGED
@@ -1,5 +1,5 @@
1
1
  <h1 align="center">
2
- 🚩 FastImage
2
+ React Native Fast Image
3
3
  </h1>
4
4
 
5
5
  <div align="center">
@@ -64,13 +64,21 @@ and
64
64
 
65
65
  ## Usage
66
66
 
67
- **Note: You must be using React Native 0.60.0 or higher to use the most recent version of `react-native-fast-image`.**
67
+ Works with React Native 0.60 and later, with the New Architecture (through React Native's interop layer) and the legacy architecture, and with Expo. It's tested on React Native 0.87 with the New Architecture, 0.73 with the legacy architecture, and Expo SDK 57. A native New Architecture component is planned for the next major version.
68
68
 
69
69
  ```bash
70
- yarn add react-native-fast-image
70
+ npm install react-native-fast-image
71
71
  cd ios && pod install
72
72
  ```
73
73
 
74
+ With Expo:
75
+
76
+ ```bash
77
+ npx expo install react-native-fast-image
78
+ ```
79
+
80
+ It has native code, so it needs a [development build](https://docs.expo.dev/develop/development-builds/introduction/) (e.g. `npx expo run:ios`), not Expo Go.
81
+
74
82
  ```jsx
75
83
  import FastImage from 'react-native-fast-image'
76
84
 
@@ -78,7 +86,7 @@ const YourImage = () => (
78
86
  <FastImage
79
87
  style={{ width: 200, height: 200 }}
80
88
  source={{
81
- uri: 'https://unsplash.it/400/400?image=1',
89
+ uri: 'https://example.com/image.jpg',
82
90
  headers: { Authorization: 'someAuthToken' },
83
91
  priority: FastImage.priority.normal,
84
92
  }}
@@ -87,9 +95,9 @@ const YourImage = () => (
87
95
  )
88
96
  ```
89
97
 
90
- ## Are you using Glide already using an AppGlideModule?
98
+ ## If your app already has an AppGlideModule
91
99
 
92
- - [Are you using Glide already using an AppGlideModule?](docs/app-glide-module.md) (you might have problems if you don't read this)
100
+ If your Android app has its own Glide `AppGlideModule`, read [using FastImage with an AppGlideModule](docs/app-glide-module.md) first, or FastImage may not work.
93
101
 
94
102
  ## Properties
95
103
 
@@ -97,13 +105,13 @@ const YourImage = () => (
97
105
 
98
106
  Source for the remote image to load.
99
107
 
100
- When `source` changes, the image that's showing stays until the new one has loaded, as with `<img>` in browsers and React Native's `Image` on iOS. In views that get reused for other content, such as rows in FlashList or recyclerlistview, set `recyclingKey` so a reused row doesn't show the previous row's image.
108
+ When `source` changes, the image that's showing stays until the new one has loaded. In views that get reused for other content, such as rows in FlashList or recyclerlistview, set `recyclingKey` so a reused row doesn't show the previous row's image.
101
109
 
102
110
  ---
103
111
 
104
112
  ### `source.uri?: string`
105
113
 
106
- Remote url to load the image from. e.g. `'https://facebook.github.io/react/img/logo_og.png'`.
114
+ Remote url to load the image from. e.g. `'https://example.com/image.jpg'`.
107
115
 
108
116
  #### Photo library images (iOS)
109
117
 
@@ -140,7 +148,7 @@ dependencies {
140
148
  }
141
149
  ```
142
150
 
143
- On Android either of AndroidSVG's packages works (`com.caverock:androidsvg-aar` or `com.caverock:androidsvg`), so an app that already has one (e.g. from another library) needs nothing more. With Expo, add the pod with [expo-build-properties](https://docs.expo.dev/versions/latest/sdk/build-properties/) (`{ "ios": { "extraPods": [{ "name": "SDWebImageSVGCoder" }] } }`); an app that uses `expo-image` already has both.
151
+ On Android either of AndroidSVG's packages works (`com.caverock:androidsvg-aar` or `com.caverock:androidsvg`), so an app that already has one needs nothing more. With Expo, add the pod with [expo-build-properties](https://docs.expo.dev/versions/latest/sdk/build-properties/) (`{ "ios": { "extraPods": [{ "name": "SDWebImageSVGCoder" }] } }`).
144
152
 
145
153
  An SVG is drawn at the size it's shown at, so it's sharp at any size, and then works like any other image: `resizeMode`, `tintColor`, `blurRadius`, `transition` and caching. `onLoad` reports the SVG's own size: its `width` and `height`, or its `viewBox`'s (300x150 if it has neither). Animated SVGs (SMIL or CSS animations) show their first state. On iOS, SVG images need iOS 13 or later. Without the SVG library, an SVG image fails with `onError`, saying what to add (on iOS, for a url that ends in `.svg`).
146
154
 
@@ -226,7 +234,7 @@ Whether the decoded image is kept in the memory cache. **Default: true.** With `
226
234
 
227
235
  - An asset loaded with `require(...)`.
228
236
  - Shown while the first image loads, and if an image fails to load. When `source` changes, the previous image shows while the new one loads instead (see `source` and `recyclingKey`).
229
- - Note that like the built-in `Image` implementation, on Android `defaultSource` does not work in debug mode. This is due to the fact that assets are sent from the dev server, but RN's functions only know how to load it from `res`.
237
+ - On Android, `defaultSource` doesn't show in debug builds: there the dev server serves `require()`d images, and `defaultSource` is only loaded from the app's resources.
230
238
 
231
239
  ---
232
240
 
@@ -245,7 +253,7 @@ For views that get reused for other content, such as rows in FlashList or recycl
245
253
  - `FastImage.resizeMode.contain` - Scale the image uniformly (maintain the image's aspect ratio) so that both dimensions (width and height) of the image will be equal to or less than the corresponding dimension of the view (minus padding).
246
254
  - `FastImage.resizeMode.cover` **(Default)** - Scale the image uniformly (maintain the image's aspect ratio) so that both dimensions (width and height) of the image will be equal to or larger than the corresponding dimension of the view (minus padding).
247
255
  - `FastImage.resizeMode.stretch` - Scale width and height independently, This may change the aspect ratio of the src.
248
- - `FastImage.resizeMode.center` - Do not scale the image, keep centered.
256
+ - `FastImage.resizeMode.center` - Center the image at its own size, scaled down uniformly to fit if it's larger than the view.
249
257
  - `FastImage.resizeMode.repeat` - Repeat the image to cover the view, from its top-left corner, at the image's own size in pixels (a bundled image at its size in points), scaled down to fit if it's larger than the view. An animated image repeats its first frame, and `defaultSource` repeats too.
250
258
 
251
259
  ---
@@ -312,7 +320,7 @@ Decoding a smaller copy can take a little longer, so use it where the memory mat
312
320
 
313
321
  ### `blurRadius?: number`
314
322
 
315
- Blurs the image by this radius, in points, like React Native's `Image` (the same radius looks about the same on iOS and Android). `0` **(Default)** is no blur.
323
+ Blurs the image by this radius, in points (the same radius looks about the same on iOS and Android). `0` **(Default)** is no blur.
316
324
 
317
325
  It's for still images, or a radius that changes now and then (e.g. blurring a photo behind a sheet). Each change blurs the image again on the CPU, so don't animate it.
318
326
 
@@ -378,10 +386,9 @@ A React Native style. Supports using `borderRadius`.
378
386
 
379
387
  ---
380
388
 
381
- ### `fallback: boolean`
389
+ ### `fallback?: boolean`
382
390
 
383
- If true will fallback to using `Image`.
384
- In this case the image will still be styled and laid out the same way as `FastImage`.
391
+ If true, the image is shown with React Native's `Image` instead, styled and laid out the same way. FastImage's own features, such as its caching options, `priority` and `transition`, don't apply.
385
392
 
386
393
  ---
387
394
 
@@ -391,7 +398,7 @@ If supplied, changes the color of all the non-transparent pixels to the given co
391
398
 
392
399
  ## `FastImageBackground`
393
400
 
394
- An image with content on top of it, like React Native's `ImageBackground`: a view that the image fills, with the children on top.
401
+ An image with content on top of it: a view that the image fills, with the children on top.
395
402
 
396
403
  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.
397
404
 
@@ -400,7 +407,7 @@ import { FastImageBackground } from 'react-native-fast-image'
400
407
 
401
408
  const Banner = () => (
402
409
  <FastImageBackground
403
- source={{ uri: 'https://unsplash.it/400/200?image=1' }}
410
+ source={{ uri: 'https://example.com/banner.jpg' }}
404
411
  style={{ width: 200, height: 100 }}
405
412
  imageStyle={{ borderRadius: 8 }}
406
413
  >
@@ -423,11 +430,11 @@ Preload images to display later. e.g.
423
430
  ```js
424
431
  FastImage.preload([
425
432
  {
426
- uri: 'https://facebook.github.io/react/img/logo_og.png',
433
+ uri: 'https://example.com/image-1.jpg',
427
434
  headers: { Authorization: 'someAuthToken' },
428
435
  },
429
436
  {
430
- uri: 'https://facebook.github.io/react/img/logo_og.png',
437
+ uri: 'https://example.com/image-2.jpg',
431
438
  headers: { Authorization: 'someAuthToken' },
432
439
  },
433
440
  ])
@@ -549,13 +556,13 @@ await FastImage.configureCache({ maxDiskSize: 500 * 1024 * 1024 })
549
556
  const { maxDiskSize, diskSize } = await FastImage.configureCache()
550
557
  ```
551
558
 
552
- On Android, if your app has its own `AppGlideModule` (see [Are you using Glide already](docs/app-glide-module.md)), set the disk cache size there instead: `maxDiskSize` isn't applied or reported.
559
+ On Android, if your app has its own `AppGlideModule` (see [using FastImage with an AppGlideModule](docs/app-glide-module.md)), set the disk cache size there instead: `maxDiskSize` isn't applied or reported.
553
560
 
554
561
  Images with `cache: 'web'` are kept in their own HTTP cache instead, up to 50 MB on each platform, which these limits don't change.
555
562
 
556
563
  ## Web
557
564
 
558
- With [react-native-web](https://necolas.github.io/react-native-web/), FastImage shows images with the web's `Image`. Bundlers pick the web version through the package's `browser` field, or the `.web.js` files next to the native ones.
565
+ FastImage works on the web with [react-native-web](https://necolas.github.io/react-native-web/). Bundlers pick the web version through the package's `browser` field, or the `.web.js` files next to the native ones.
559
566
 
560
567
  Support is minimal:
561
568
 
@@ -572,13 +579,6 @@ If you have any problems using this library try the steps in [troubleshooting](d
572
579
 
573
580
  [Follow these instructions to get the example app running.](docs/development.md)
574
581
 
575
- ## Supported React Native Versions
576
-
577
- This project only aims to support the latest version of React Native.\
578
- This simplifies the development and the testing of the project.
579
-
580
- If you require new features or bug fixes for older versions you can fork this project.
581
-
582
582
  ## Credits
583
583
 
584
584
  The idea for this modules came from
@@ -591,9 +591,9 @@ Thanks to [@mobinni](https://github.com/mobinni) for helping with the conceptual
591
591
 
592
592
  ## Licenses
593
593
 
594
- - FastImage - MIT © [DylanVann](https://github.com/DylanVann)
595
- - SDWebImage - `MIT`
596
- - Glide - BSD, part MIT and Apache 2.0. See the [LICENSE](https://github.com/bumptech/glide/blob/master/LICENSE) file for details.
594
+ - React Native Fast Image - MIT © [Dylan Vann](https://github.com/DylanVann). See the [LICENSE](LICENSE) file.
595
+ - [SDWebImage](https://github.com/SDWebImage/SDWebImage) (iOS) - MIT. See its [LICENSE](https://github.com/SDWebImage/SDWebImage/blob/master/LICENSE) file.
596
+ - [Glide](https://github.com/bumptech/glide) (Android) - BSD, part MIT and Apache 2.0. See its [LICENSE](https://github.com/bumptech/glide/blob/master/LICENSE) file.
597
597
 
598
598
  [build-badge]: https://github.com/DylanVann/react-native-fast-image/actions/workflows/ci.yml/badge.svg
599
599
  [build]: https://github.com/DylanVann/react-native-fast-image/actions/workflows/ci.yml
package/dist/index.d.ts CHANGED
@@ -110,18 +110,8 @@ export interface OnProgressEvent {
110
110
  };
111
111
  }
112
112
  export interface ImageStyle extends ViewStyle {
113
- backfaceVisibility?: 'visible' | 'hidden';
114
- borderBottomLeftRadius?: number;
115
- borderBottomRightRadius?: number;
116
- backgroundColor?: ColorValue;
117
- borderColor?: ColorValue;
118
- borderWidth?: number;
119
- borderRadius?: number;
120
- borderTopLeftRadius?: number;
121
- borderTopRightRadius?: number;
122
- overlayColor?: ColorValue;
123
- tintColor?: ColorValue;
124
- opacity?: number;
113
+ overlayColor?: ViewStyle['backgroundColor'];
114
+ tintColor?: ViewStyle['backgroundColor'];
125
115
  }
126
116
  export interface FastImageProps extends AccessibilityProps, ViewProps {
127
117
  /**
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "react-native-fast-image",
3
- "version": "8.27.0",
4
- "description": "🚩 FastImage, performant React Native image component.",
3
+ "version": "8.27.1",
4
+ "description": "FastImage, performant React Native image component.",
5
5
  "keywords": [
6
6
  "cache",
7
7
  "cached",