react-native-nitro-image-pipeline 1.5.0 → 1.6.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 +56 -7
- package/android/src/main/java/com/margelo/nitro/nitroimagepipeline/HybridNitroImagePipeline.kt +27 -2
- package/ios/HybridNitroImagePipeline.swift +47 -9
- package/ios/PipelineImageLoader.swift +2 -2
- package/lib/commonjs/NativePipelineImage.js +2 -1
- package/lib/commonjs/NativePipelineImage.js.map +1 -1
- package/lib/commonjs/PipelineImage.js.map +1 -1
- package/lib/commonjs/index.js +13 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/resolveImageSource.js +89 -0
- package/lib/commonjs/resolveImageSource.js.map +1 -0
- package/lib/commonjs/useImage.js +8 -4
- package/lib/commonjs/useImage.js.map +1 -1
- package/lib/commonjs/usePipelineImageLoader.js +8 -3
- package/lib/commonjs/usePipelineImageLoader.js.map +1 -1
- package/lib/module/NativePipelineImage.js +2 -1
- package/lib/module/NativePipelineImage.js.map +1 -1
- package/lib/module/PipelineImage.js.map +1 -1
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/resolveImageSource.js +83 -0
- package/lib/module/resolveImageSource.js.map +1 -0
- package/lib/module/useImage.js +8 -4
- package/lib/module/useImage.js.map +1 -1
- package/lib/module/usePipelineImageLoader.js +8 -3
- package/lib/module/usePipelineImageLoader.js.map +1 -1
- package/lib/typescript/src/NativePipelineImage.d.ts +7 -2
- package/lib/typescript/src/NativePipelineImage.d.ts.map +1 -1
- package/lib/typescript/src/PipelineImage.d.ts +7 -2
- package/lib/typescript/src/PipelineImage.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +1 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/resolveImageSource.d.ts +56 -0
- package/lib/typescript/src/resolveImageSource.d.ts.map +1 -0
- package/lib/typescript/src/specs/nitro-image-toolkit.nitro.d.ts +12 -0
- package/lib/typescript/src/specs/nitro-image-toolkit.nitro.d.ts.map +1 -1
- package/lib/typescript/src/useImage.d.ts +10 -4
- package/lib/typescript/src/useImage.d.ts.map +1 -1
- package/lib/typescript/src/usePipelineImageLoader.d.ts +4 -2
- package/lib/typescript/src/usePipelineImageLoader.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/NativePipelineImage.tsx +8 -3
- package/src/PipelineImage.tsx +7 -2
- package/src/index.ts +5 -0
- package/src/resolveImageSource.ts +83 -0
- package/src/specs/nitro-image-toolkit.nitro.ts +12 -0
- package/src/useImage.ts +26 -15
- package/src/usePipelineImageLoader.ts +11 -3
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ A high-performance image loading, caching, and processing library for React Nati
|
|
|
8
8
|
|
|
9
9
|
## Features
|
|
10
10
|
|
|
11
|
-
- Load
|
|
11
|
+
- Load images from the network (with built-in memory and disk caching), the file system, or bundled `require()` assets
|
|
12
12
|
- Prefetch single or multiple images in the background
|
|
13
13
|
- Resize (aspect-fill, center-crop) and apply Gaussian blur and rounded corners (uniform or per-corner) at load time
|
|
14
14
|
- Apply Gaussian blur to already-loaded images
|
|
@@ -177,6 +177,41 @@ function BlurFade({ url, blurred }: { url: string; blurred: boolean }) {
|
|
|
177
177
|
}
|
|
178
178
|
```
|
|
179
179
|
|
|
180
|
+
### Local images and `require()`
|
|
181
|
+
|
|
182
|
+
Every `url` in this library — `<PipelineImage>`, `<NativePipelineImage>`, `useImage`,
|
|
183
|
+
`usePipelineImageLoader` — also takes a `require()`d asset, and any `url` string may point at the
|
|
184
|
+
file system. The image goes through the same pipeline, so a bundled logo or a photo from the camera
|
|
185
|
+
roll gets the same resize-to-layout, blur and rounded corners as a download:
|
|
186
|
+
|
|
187
|
+
```tsx
|
|
188
|
+
// A bundled asset — streamed from Metro in debug, read from the app bundle /
|
|
189
|
+
// resources in release, at the scale that matches the screen (like <Image>).
|
|
190
|
+
<PipelineImage url={require('./assets/logo.png')} style={styles.logo} blur={2} />
|
|
191
|
+
|
|
192
|
+
// A file on disk — a `file://` URL or a plain absolute path, e.g. the path
|
|
193
|
+
// react-native-nitro-image's `saveToTemporaryFileAsync` returns.
|
|
194
|
+
<NativePipelineImage url={`file://${photoPath}`} style={styles.thumb} />
|
|
195
|
+
<NativePipelineImage url={photoPath} style={styles.thumb} />
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
The direct `NitroImagePipeline.loadImage`/`createImageLoader` calls take a string; resolve a
|
|
199
|
+
`require()` first with `resolveImageUrl`:
|
|
200
|
+
|
|
201
|
+
```ts
|
|
202
|
+
import { NitroImagePipeline, resolveImageUrl } from 'react-native-nitro-image-pipeline';
|
|
203
|
+
|
|
204
|
+
const logo = await NitroImagePipeline.loadImage(resolveImageUrl(require('./assets/logo.png')), {
|
|
205
|
+
resize: { width: 200, height: 200 },
|
|
206
|
+
});
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
Accepted `url` forms: `http(s)://`, `file://`, a plain absolute path, `data:`, and on Android also
|
|
210
|
+
`content://` URIs and bare drawable resource names (what `require()` resolves to in a release build
|
|
211
|
+
there). Local sources are cached **in memory only** — there is nothing to gain from copying a file
|
|
212
|
+
that is already on disk into the disk cache — so `cache: 'disk'` on a local `url` means no caching,
|
|
213
|
+
and `preLoadImage(s)` treats local sources as a no-op.
|
|
214
|
+
|
|
180
215
|
### `useImage` hook
|
|
181
216
|
|
|
182
217
|
The simplest way to load an image in a component:
|
|
@@ -249,7 +284,10 @@ await NitroImagePipeline.clearCache();
|
|
|
249
284
|
|
|
250
285
|
### `loadImage(url, options?)`
|
|
251
286
|
|
|
252
|
-
Loads an image from a URL and returns a `Promise<Image>`.
|
|
287
|
+
Loads an image from a URL and returns a `Promise<Image>`. `url` is a string — `http(s)://`, `file://`,
|
|
288
|
+
a plain absolute path, or the other forms listed under
|
|
289
|
+
[Local images and `require()`](#local-images-and-require); pass a `require()` through
|
|
290
|
+
[`resolveImageUrl`](#resolveimageurlsource) first.
|
|
253
291
|
|
|
254
292
|
| Option | Type | Default | Description |
|
|
255
293
|
|---|---|---|---|
|
|
@@ -262,7 +300,7 @@ Loads an image from a URL and returns a `Promise<Image>`.
|
|
|
262
300
|
|
|
263
301
|
| Prop | Type | Default | Description |
|
|
264
302
|
|---|---|---|---|
|
|
265
|
-
| `url` | `string` | — | Image
|
|
303
|
+
| `url` | `string \| number` | — | Image to load: a URL string (`https://`, `file://`, an absolute path) or a `require()`d asset |
|
|
266
304
|
| `style` | `StyleProp<ViewStyle>` | — | Layout style; also determines the resize target (see [`resizeForStyle`](#resizeforstyle-style--resizeforlayoutwidth-height)) and, if `cornerRadius` is omitted, the corner radius (see [`cornerRadiusForStyle`](#cornerradiusforstylestyle)) |
|
|
267
305
|
| `blur` | `number` | `0` | Gaussian blur strength, in **points** (converted to bitmap pixels internally) |
|
|
268
306
|
| `cornerRadius` | `number \| CornerRadii` | derived from `style` | Corner radius, in **points** (converted to bitmap pixels internally). When omitted, derived from `style`'s `borderRadius`/`borderTopLeftRadius`/etc.; square if neither is set |
|
|
@@ -277,7 +315,7 @@ Loads an image from a URL and returns a `Promise<Image>`.
|
|
|
277
315
|
|
|
278
316
|
| Prop | Type | Default | Description |
|
|
279
317
|
|---|---|---|---|
|
|
280
|
-
| `url` | `string` | — | Image
|
|
318
|
+
| `url` | `string \| number` | — | Image to load: a URL string (`https://`, `file://`, an absolute path) or a `require()`d asset |
|
|
281
319
|
| `style` | `StyleProp<ViewStyle>` | — | Layout style. The native side measures the view and loads at that size; `borderRadius`-family properties drive `cornerRadius` when it's omitted |
|
|
282
320
|
| `blur` | `number` | `0` | Gaussian blur strength, in **points** (screen scale applied natively) |
|
|
283
321
|
| `cornerRadius` | `number \| CornerRadii` | derived from `style` | Corner radius, in **points** (screen scale applied natively) |
|
|
@@ -288,15 +326,25 @@ Loads an image from a URL and returns a `Promise<Image>`.
|
|
|
288
326
|
|
|
289
327
|
No `onLoad`/`onError`: loading happens entirely natively and the result never crosses into JS.
|
|
290
328
|
|
|
291
|
-
### `createImageLoader(url, options?)` / `usePipelineImageLoader(
|
|
329
|
+
### `createImageLoader(url, options?)` / `usePipelineImageLoader(source, options?)`
|
|
292
330
|
|
|
293
331
|
Creates the [`ImageLoader`](https://github.com/mrousavy/react-native-nitro-image) that powers
|
|
294
332
|
`<NativePipelineImage>`, for use with your own `<NativeNitroImage image={loader} />`. The view
|
|
295
333
|
calls into it natively when it attaches (load at the view's laid-out size) and detaches
|
|
296
334
|
(cancel + release). `options` takes `blur`/`cornerRadius` in **points** and an optional
|
|
297
335
|
pixel-based `resize` override — see the `ViewOptions` type. The hook memoizes by value, so
|
|
298
|
-
inline options literals are fine
|
|
299
|
-
the processed `Image`.
|
|
336
|
+
inline options literals are fine, and its `source` may be a `require()` as well as a URL string.
|
|
337
|
+
`loader.loadImage()` also works imperatively and resolves with the processed `Image`.
|
|
338
|
+
|
|
339
|
+
### `resolveImageUrl(source)`
|
|
340
|
+
|
|
341
|
+
Turns an `ImageSource` (`string | number`) into the URL string the native pipeline loads: strings
|
|
342
|
+
pass through unchanged, a `require()`d asset is resolved with `Image.resolveAssetSource` to the
|
|
343
|
+
scale-matched variant. The components and hooks do this internally; use it when calling
|
|
344
|
+
`loadImage`, `createImageLoader` or `preLoadImage(s)` directly with a `require()`. Throws if the
|
|
345
|
+
number is not a registered asset; the components and hooks never throw for one — `useImage` reports
|
|
346
|
+
it through `error`, and `usePipelineImageLoader`/`<NativePipelineImage>` load a URL no loader can
|
|
347
|
+
resolve, so the request fails at load time like a missing file.
|
|
300
348
|
|
|
301
349
|
### `resizeForStyle(style)` / `resizeForLayout(width, height)`
|
|
302
350
|
|
|
@@ -317,6 +365,7 @@ omitted.
|
|
|
317
365
|
### `preLoadImage(url)`
|
|
318
366
|
|
|
319
367
|
Prefetches a single image into the **disk cache**, without decoding it. Returns `Promise<void>`.
|
|
368
|
+
Local sources (`file://`, paths, resources) have no download to cache and are a no-op.
|
|
320
369
|
|
|
321
370
|
Prefetching only pays the network and disk I/O cost up front — no bitmap is decoded or held in
|
|
322
371
|
memory, so prefetching a long list of URLs doesn't balloon RAM. The image is decoded (at the
|
package/android/src/main/java/com/margelo/nitro/nitroimagepipeline/HybridNitroImagePipeline.kt
CHANGED
|
@@ -3,6 +3,7 @@ package com.margelo.nitro.nitroimagepipeline
|
|
|
3
3
|
import android.content.Context
|
|
4
4
|
import android.graphics.Bitmap
|
|
5
5
|
import androidx.core.graphics.drawable.toBitmap
|
|
6
|
+
import androidx.core.net.toUri
|
|
6
7
|
import coil3.BitmapImage
|
|
7
8
|
import coil3.ColorImage
|
|
8
9
|
import coil3.DrawableImage
|
|
@@ -76,7 +77,7 @@ class HybridNitroImagePipeline : HybridNitroImagePipelineSpec() {
|
|
|
76
77
|
// size — only when a loadImage actually displays it.
|
|
77
78
|
private fun preloadRequest(url: String): ImageRequest =
|
|
78
79
|
ImageRequest.Builder(context)
|
|
79
|
-
.data(url)
|
|
80
|
+
.data(requestData(context, url))
|
|
80
81
|
.memoryCachePolicy(CachePolicy.DISABLED)
|
|
81
82
|
.decoderFactory { _, _, _ -> Decoder { DecodeResult(ColorImage(), false) } }
|
|
82
83
|
.build()
|
|
@@ -192,7 +193,7 @@ class HybridNitroImagePipeline : HybridNitroImagePipelineSpec() {
|
|
|
192
193
|
}
|
|
193
194
|
}
|
|
194
195
|
return ImageRequest.Builder(context)
|
|
195
|
-
.data(url)
|
|
196
|
+
.data(requestData(context, url))
|
|
196
197
|
.apply {
|
|
197
198
|
when (options?.cache) {
|
|
198
199
|
CacheOption.MEMORY -> {
|
|
@@ -222,6 +223,30 @@ class HybridNitroImagePipeline : HybridNitroImagePipelineSpec() {
|
|
|
222
223
|
.build()
|
|
223
224
|
}
|
|
224
225
|
|
|
226
|
+
/**
|
|
227
|
+
* What Coil should load for [url]. Coil itself handles `http(s)://`, `file://`, `content://`
|
|
228
|
+
* and plain absolute paths. The one form it doesn't is a bare resource name — a string with
|
|
229
|
+
* no scheme, like `src_assets_logo` — which is what React Native's `require()` resolves to
|
|
230
|
+
* in a release build (assets are packed into `res/drawable-*`). Resolve that to the resource
|
|
231
|
+
* id here; the density-qualified variant is then picked by the resources system, like
|
|
232
|
+
* `<Image>` does. An unknown name is passed through so Coil reports the failure as an
|
|
233
|
+
* [ErrorResult] (the loaders must not throw while building a request).
|
|
234
|
+
*/
|
|
235
|
+
internal fun requestData(context: Context, url: String): Any {
|
|
236
|
+
if (url.startsWith("/") || url.toUri().scheme != null) return url
|
|
237
|
+
// Tolerate `logo.png`: RN's generated names carry no extension, but nitro-image's
|
|
238
|
+
// `{ resource: 'logo.png' }` convention does.
|
|
239
|
+
val name = url.substringBefore('.')
|
|
240
|
+
for (type in RESOURCE_TYPES) {
|
|
241
|
+
val id = context.resources.getIdentifier(name, type, context.packageName)
|
|
242
|
+
if (id != 0) return id
|
|
243
|
+
}
|
|
244
|
+
return url
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/** Where React Native puts bundled image assets, then the other image resource types. */
|
|
248
|
+
private val RESOURCE_TYPES = arrayOf("drawable", "mipmap", "raw")
|
|
249
|
+
|
|
225
250
|
/** The decoded bitmap of a successful load. */
|
|
226
251
|
internal fun bitmapOf(result: SuccessResult): Bitmap =
|
|
227
252
|
when (val img = result.image) {
|
|
@@ -138,13 +138,43 @@ class HybridNitroImagePipeline: HybridNitroImagePipelineSpec {
|
|
|
138
138
|
private var pipeline: ImagePipeline { Self.sharedPipeline }
|
|
139
139
|
private var prefetcher: ImagePrefetcher { Self.sharedPrefetcher }
|
|
140
140
|
|
|
141
|
-
|
|
142
|
-
|
|
141
|
+
/// The `URL` for a `url` string as the JS API accepts it: a URL with a
|
|
142
|
+
/// scheme (`https://`, `file://`, …), or a plain absolute file-system
|
|
143
|
+
/// path — the form react-native-nitro-image's `saveToTemporaryFileAsync`
|
|
144
|
+
/// returns — which becomes a `file://` URL.
|
|
145
|
+
static func url(from string: String) -> URL? {
|
|
146
|
+
if string.hasPrefix("/") {
|
|
147
|
+
return URL(fileURLWithPath: string)
|
|
148
|
+
}
|
|
149
|
+
return URL(string: string)
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/// Whether `url` is fetched over the network, as opposed to read from the
|
|
153
|
+
/// file system (`file://`, incl. `require()`d assets in release builds)
|
|
154
|
+
/// or decoded inline (`data:`).
|
|
155
|
+
static func isNetworkURL(_ url: URL) -> Bool {
|
|
156
|
+
switch url.scheme?.lowercased() {
|
|
157
|
+
case "http", "https": true
|
|
158
|
+
default: false
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
private static func cacheOptions(for cache: CacheOption?, url: URL) -> ImageRequest.Options {
|
|
163
|
+
var options: ImageRequest.Options = switch cache {
|
|
143
164
|
case .memory: [.disableDiskCache]
|
|
144
165
|
case .disk: [.disableMemoryCache]
|
|
145
166
|
case .none?: [.disableDiskCache, .disableMemoryCache]
|
|
146
167
|
default: []
|
|
147
168
|
}
|
|
169
|
+
// A local source has nothing to gain from the disk cache: the
|
|
170
|
+
// pipeline's `.storeAll` policy would copy the file's bytes into the
|
|
171
|
+
// data cache next to the original. Keep local images in memory only —
|
|
172
|
+
// Coil does the same on Android, where only network fetches are
|
|
173
|
+
// written to disk — so `cache: 'disk'` on a local URL means no cache.
|
|
174
|
+
if !isNetworkURL(url) {
|
|
175
|
+
options.insert(.disableDiskCache)
|
|
176
|
+
}
|
|
177
|
+
return options
|
|
148
178
|
}
|
|
149
179
|
|
|
150
180
|
/// The processor that bakes `cornerRadius` into the bitmap, or `nil` when
|
|
@@ -205,7 +235,7 @@ class HybridNitroImagePipeline: HybridNitroImagePipelineSpec {
|
|
|
205
235
|
var imgRequest = ImageRequest(
|
|
206
236
|
url: url,
|
|
207
237
|
processors: processors(for: options),
|
|
208
|
-
options: cacheOptions(for: options?.cache)
|
|
238
|
+
options: cacheOptions(for: options?.cache, url: url)
|
|
209
239
|
)
|
|
210
240
|
// With a target size known, decode near it (aspect-fill, so the
|
|
211
241
|
// decoded image always covers the target) instead of at full
|
|
@@ -225,7 +255,7 @@ class HybridNitroImagePipeline: HybridNitroImagePipelineSpec {
|
|
|
225
255
|
|
|
226
256
|
func loadImage(url: String, options: Options?) throws -> Promise<any HybridImageSpec> {
|
|
227
257
|
return Promise.async {
|
|
228
|
-
guard let imageUrl =
|
|
258
|
+
guard let imageUrl = Self.url(from: url) else {
|
|
229
259
|
throw RuntimeError.error(withMessage: "Invalid URL: \(url)")
|
|
230
260
|
}
|
|
231
261
|
|
|
@@ -243,21 +273,29 @@ class HybridNitroImagePipeline: HybridNitroImagePipelineSpec {
|
|
|
243
273
|
|
|
244
274
|
func preLoadImage(url: String) throws -> Promise<Void> {
|
|
245
275
|
return Promise.async {
|
|
246
|
-
guard let imageUrl =
|
|
276
|
+
guard let imageUrl = Self.url(from: url) else {
|
|
247
277
|
throw RuntimeError.error(withMessage: "Invalid URL: \(url)")
|
|
248
278
|
}
|
|
249
|
-
|
|
250
|
-
self.prefetcher.startPrefetching(with: [imageUrl])
|
|
279
|
+
self.prefetch([imageUrl])
|
|
251
280
|
}
|
|
252
281
|
}
|
|
253
282
|
|
|
254
283
|
func preLoadImages(urls: [String]) throws -> Promise<Void> {
|
|
255
284
|
return Promise.async {
|
|
256
|
-
|
|
257
|
-
self.prefetcher.startPrefetching(with: imageUrls)
|
|
285
|
+
self.prefetch(urls.compactMap { Self.url(from: $0) })
|
|
258
286
|
}
|
|
259
287
|
}
|
|
260
288
|
|
|
289
|
+
/// Prefetching warms the disk cache with a download; a local source has no
|
|
290
|
+
/// download to warm it with, so those are a no-op (as on Android, where
|
|
291
|
+
/// Coil never writes non-network sources to disk) rather than a copy of
|
|
292
|
+
/// the file into the data cache.
|
|
293
|
+
private func prefetch(_ urls: [URL]) {
|
|
294
|
+
let networkUrls = urls.filter(Self.isNetworkURL)
|
|
295
|
+
guard !networkUrls.isEmpty else { return }
|
|
296
|
+
prefetcher.startPrefetching(with: networkUrls)
|
|
297
|
+
}
|
|
298
|
+
|
|
261
299
|
func setMemoryCacheLimit(bytes: Double) throws {
|
|
262
300
|
guard bytes >= 0, bytes.isFinite else {
|
|
263
301
|
throw RuntimeError.error(
|
|
@@ -90,7 +90,7 @@ class PipelineImageLoader: HybridImageLoaderSpec {
|
|
|
90
90
|
|
|
91
91
|
func loadImage() throws -> Promise<any HybridImageSpec> {
|
|
92
92
|
return Promise.async {
|
|
93
|
-
guard let imageUrl =
|
|
93
|
+
guard let imageUrl = HybridNitroImagePipeline.url(from: self.url) else {
|
|
94
94
|
throw RuntimeError.error(withMessage: "Invalid URL: \(self.url)")
|
|
95
95
|
}
|
|
96
96
|
// No view to measure here: use the explicit resize if given, and
|
|
@@ -167,7 +167,7 @@ class PipelineImageLoader: HybridImageLoaderSpec {
|
|
|
167
167
|
}
|
|
168
168
|
|
|
169
169
|
private func start(into imageView: UIImageView, key: ObjectIdentifier, sizePx: CGSize) {
|
|
170
|
-
guard let imageUrl =
|
|
170
|
+
guard let imageUrl = HybridNitroImagePipeline.url(from: url) else { return }
|
|
171
171
|
let scale = Self.displayScale(of: imageView)
|
|
172
172
|
let request = HybridNitroImagePipeline.makeRequest(
|
|
173
173
|
url: imageUrl,
|
|
@@ -7,6 +7,7 @@ exports.NativePipelineImage = void 0;
|
|
|
7
7
|
var _react = require("react");
|
|
8
8
|
var _reactNativeNitroImage = require("react-native-nitro-image");
|
|
9
9
|
var _resizeForStyle = require("./resizeForStyle");
|
|
10
|
+
var _resolveImageSource = require("./resolveImageSource");
|
|
10
11
|
var _usePipelineImageLoader = require("./usePipelineImageLoader");
|
|
11
12
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
13
|
/**
|
|
@@ -57,7 +58,7 @@ const NativePipelineImage = exports.NativePipelineImage = /*#__PURE__*/(0, _reac
|
|
|
57
58
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeNitroImage.NativeNitroImage
|
|
58
59
|
// Before the spread so a caller-provided recyclingKey wins.
|
|
59
60
|
, {
|
|
60
|
-
recyclingKey: url,
|
|
61
|
+
recyclingKey: (0, _resolveImageSource.recyclingKeyFor)(url),
|
|
61
62
|
...viewProps,
|
|
62
63
|
ref: ref,
|
|
63
64
|
style: style,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","_reactNativeNitroImage","_resizeForStyle","_usePipelineImageLoader","_jsxRuntime","NativePipelineImage","exports","forwardRef","url","blur","cornerRadius","cache","resize","style","viewProps","ref","effectiveCornerRadius","cornerRadiusForStyle","loader","usePipelineImageLoader","jsx","NativeNitroImage","recyclingKey","image","displayName"],"sourceRoot":"../../src","sources":["NativePipelineImage.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,sBAAA,GAAAD,OAAA;AAEA,IAAAE,eAAA,GAAAF,OAAA;
|
|
1
|
+
{"version":3,"names":["_react","require","_reactNativeNitroImage","_resizeForStyle","_resolveImageSource","_usePipelineImageLoader","_jsxRuntime","NativePipelineImage","exports","forwardRef","url","blur","cornerRadius","cache","resize","style","viewProps","ref","effectiveCornerRadius","cornerRadiusForStyle","loader","usePipelineImageLoader","jsx","NativeNitroImage","recyclingKey","recyclingKeyFor","image","displayName"],"sourceRoot":"../../src","sources":["NativePipelineImage.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,sBAAA,GAAAD,OAAA;AAEA,IAAAE,eAAA,GAAAF,OAAA;AACA,IAAAG,mBAAA,GAAAH,OAAA;AAMA,IAAAI,uBAAA,GAAAJ,OAAA;AAAkE,IAAAK,WAAA,GAAAL,OAAA;AAKlE;AACA;AACA;AACA;AACA;;AAmCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMM,mBAAmB,GAAAC,OAAA,CAAAD,mBAAA,gBAAG,IAAAE,iBAAU,EAG3C,SAASF,mBAAmBA,CAC5B;EAAEG,GAAG;EAAEC,IAAI;EAAEC,YAAY;EAAEC,KAAK;EAAEC,MAAM;EAAEC,KAAK;EAAE,GAAGC;AAAU,CAAC,EAC/DC,GAAG,EACH;EACA;EACA,MAAMC,qBAAqB,GAAGN,YAAY,IAAI,IAAAO,oCAAoB,EAACJ,KAAK,CAAC;EACzE,MAAMK,MAAM,GAAG,IAAAC,8CAAsB,EAACX,GAAG,EAAE;IACzCC,IAAI;IACJC,YAAY,EAAEM,qBAAqB;IACnCL,KAAK;IACLC;EACF,CAAC,CAAC;EAEF,oBACE,IAAAR,WAAA,CAAAgB,GAAA,EAACpB,sBAAA,CAAAqB;EACC;EAAA;IACAC,YAAY,EAAE,IAAAC,mCAAe,EAACf,GAAG,CAAE;IAAA,GAC/BM,SAAS;IACbC,GAAG,EAAEA,GAAI;IACTF,KAAK,EAAEA,KAAM;IACbW,KAAK,EAAEN;EAAO,CACf,CAAC;AAEN,CAAC,CAAC;;AAEF;AACA;AACAb,mBAAmB,CAACoB,WAAW,GAAG,qBAAqB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","_reactNative","_reactNativeNitroImage","_resizeForStyle","_useImage","_jsxRuntime","sameSize","a","b","width","height","scaleRadius","cornerRadius","scale","topLeft","topRight","bottomLeft","bottomRight","PipelineImage","exports","forwardRef","url","blur","cache","onLoad","onError","style","onLayout","viewProps","ref","PixelRatio","get","styleSize","resizeForStyle","layoutSize","setLayoutSize","useState","undefined","resize","effectiveCornerRadius","cornerRadiusForStyle","image","error","useImage","enabled","onLoadRef","useRef","onErrorRef","useEffect","current","handleLayout","event","nativeEvent","layout","next","resizeForLayout","prev","jsx","NativeNitroImage","displayName"],"sourceRoot":"../../src","sources":["PipelineImage.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAOA,IAAAC,YAAA,GAAAD,OAAA;AAKA,IAAAE,sBAAA,GAAAF,OAAA;AAEA,IAAAG,eAAA,GAAAH,OAAA;
|
|
1
|
+
{"version":3,"names":["_react","require","_reactNative","_reactNativeNitroImage","_resizeForStyle","_useImage","_jsxRuntime","sameSize","a","b","width","height","scaleRadius","cornerRadius","scale","topLeft","topRight","bottomLeft","bottomRight","PipelineImage","exports","forwardRef","url","blur","cache","onLoad","onError","style","onLayout","viewProps","ref","PixelRatio","get","styleSize","resizeForStyle","layoutSize","setLayoutSize","useState","undefined","resize","effectiveCornerRadius","cornerRadiusForStyle","image","error","useImage","enabled","onLoadRef","useRef","onErrorRef","useEffect","current","handleLayout","event","nativeEvent","layout","next","resizeForLayout","prev","jsx","NativeNitroImage","displayName"],"sourceRoot":"../../src","sources":["PipelineImage.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAOA,IAAAC,YAAA,GAAAD,OAAA;AAKA,IAAAE,sBAAA,GAAAF,OAAA;AAEA,IAAAG,eAAA,GAAAH,OAAA;AAWA,IAAAI,SAAA,GAAAJ,OAAA;AAAsC,IAAAK,WAAA,GAAAL,OAAA;AAKtC;AACA;AACA;AACA;AACA;;AAoCA,SAASM,QAAQA,CAACC,CAAiB,EAAEC,CAAiB,EAAW;EAC/D,OAAOD,CAAC,EAAEE,KAAK,KAAKD,CAAC,EAAEC,KAAK,IAAIF,CAAC,EAAEG,MAAM,KAAKF,CAAC,EAAEE,MAAM;AACzD;AAEA,SAASC,WAAWA,CAClBC,YAAkC,EAClCC,KAAa,EACS;EACtB,IAAI,OAAOD,YAAY,KAAK,QAAQ,EAAE;IACpC,OAAOA,YAAY,GAAGC,KAAK;EAC7B;EACA,OAAO;IACLC,OAAO,EAAE,CAACF,YAAY,CAACE,OAAO,IAAI,CAAC,IAAID,KAAK;IAC5CE,QAAQ,EAAE,CAACH,YAAY,CAACG,QAAQ,IAAI,CAAC,IAAIF,KAAK;IAC9CG,UAAU,EAAE,CAACJ,YAAY,CAACI,UAAU,IAAI,CAAC,IAAIH,KAAK;IAClDI,WAAW,EAAE,CAACL,YAAY,CAACK,WAAW,IAAI,CAAC,IAAIJ;EACjD,CAAC;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,CAAC;EACF,IAAAuB,gBAAS,EAAC,MAAM;IACd,IAAIP,KAAK,EAAEI,SAAS,CAACI,OAAO,GAAGR,KAAK,CAAC;EACvC,CAAC,EAAE,CAACA,KAAK,CAAC,CAAC;EACX,IAAAO,gBAAS,EAAC,MAAM;IACd,IAAIN,KAAK,EAAEK,UAAU,CAACE,OAAO,GAAGP,KAAK,CAAC;EACxC,CAAC,EAAE,CAACA,KAAK,CAAC,CAAC;EAEX,MAAMQ,YAAY,GAAIC,KAAwB,IAAK;IACjDxB,QAAQ,GAAGwB,KAAK,CAAC;IACjB,MAAM;MAAE1C,KAAK;MAAEC;IAAO,CAAC,GAAGyC,KAAK,CAACC,WAAW,CAACC,MAAM;IAClD,MAAMC,IAAI,GAAG,IAAAC,+BAAe,EAAC9C,KAAK,EAAEC,MAAM,CAAC;IAC3C;IACA;IACAyB,aAAa,CAAEqB,IAAI,IAAMlD,QAAQ,CAACkD,IAAI,EAAEF,IAAI,CAAC,GAAGE,IAAI,GAAGF,IAAK,CAAC;EAC/D,CAAC;EAED,oBACE,IAAAjD,WAAA,CAAAoD,GAAA,EAACvD,sBAAA,CAAAwD,gBAAgB;IAAA,GACX9B,SAAS;IACbC,GAAG,EAAEA,GAAI;IACTH,KAAK,EAAEA,KAAM;IACbC,QAAQ,EAAEuB,YAAa;IACvBT,KAAK,EAAEA;EAAM,CACd,CAAC;AAEN,CACF,CAAC;;AAED;AACA;AACAvB,aAAa,CAACyC,WAAW,GAAG,eAAe","ignoreList":[]}
|
package/lib/commonjs/index.js
CHANGED
|
@@ -21,6 +21,12 @@ Object.defineProperty(exports, "PipelineImage", {
|
|
|
21
21
|
return _PipelineImage.PipelineImage;
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
|
+
Object.defineProperty(exports, "UNREGISTERED_ASSET_URL", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return _resolveImageSource.UNREGISTERED_ASSET_URL;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
24
30
|
Object.defineProperty(exports, "cornerRadiusForStyle", {
|
|
25
31
|
enumerable: true,
|
|
26
32
|
get: function () {
|
|
@@ -39,6 +45,12 @@ Object.defineProperty(exports, "resizeForStyle", {
|
|
|
39
45
|
return _resizeForStyle.resizeForStyle;
|
|
40
46
|
}
|
|
41
47
|
});
|
|
48
|
+
Object.defineProperty(exports, "resolveImageUrl", {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function () {
|
|
51
|
+
return _resolveImageSource.resolveImageUrl;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
42
54
|
Object.defineProperty(exports, "useImage", {
|
|
43
55
|
enumerable: true,
|
|
44
56
|
get: function () {
|
|
@@ -54,6 +66,7 @@ Object.defineProperty(exports, "usePipelineImageLoader", {
|
|
|
54
66
|
var _NativePipelineImage = require("./NativePipelineImage");
|
|
55
67
|
var _NitroImagePipeline = require("./NitroImagePipeline");
|
|
56
68
|
var _PipelineImage = require("./PipelineImage");
|
|
69
|
+
var _resolveImageSource = require("./resolveImageSource");
|
|
57
70
|
var _resizeForStyle = require("./resizeForStyle");
|
|
58
71
|
var _useImage = require("./useImage");
|
|
59
72
|
var _usePipelineImageLoader = require("./usePipelineImageLoader");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_NativePipelineImage","require","_NitroImagePipeline","_PipelineImage","_resizeForStyle","_useImage","_usePipelineImageLoader"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"names":["_NativePipelineImage","require","_NitroImagePipeline","_PipelineImage","_resolveImageSource","_resizeForStyle","_useImage","_usePipelineImageLoader"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,oBAAA,GAAAC,OAAA;AAKA,IAAAC,mBAAA,GAAAD,OAAA;AACA,IAAAE,cAAA,GAAAF,OAAA;AAKA,IAAAG,mBAAA,GAAAH,OAAA;AAKA,IAAAI,eAAA,GAAAJ,OAAA;AAYA,IAAAK,SAAA,GAAAL,OAAA;AACA,IAAAM,uBAAA,GAAAN,OAAA","ignoreList":[]}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.UNREGISTERED_ASSET_URL = void 0;
|
|
7
|
+
exports.recyclingKeyFor = recyclingKeyFor;
|
|
8
|
+
exports.resolveImageUrl = resolveImageUrl;
|
|
9
|
+
exports.resolveImageUrlOrFallback = resolveImageUrlOrFallback;
|
|
10
|
+
var _reactNative = require("react-native");
|
|
11
|
+
/**
|
|
12
|
+
* What the pipeline can load: a URL string, or the id a `require()`d image
|
|
13
|
+
* asset evaluates to.
|
|
14
|
+
*
|
|
15
|
+
* As a string, `url` is passed to the native loader as-is. Accepted forms:
|
|
16
|
+
*
|
|
17
|
+
* - `https://` / `http://` — fetched over the network and cached on disk.
|
|
18
|
+
* - `file://` URLs and plain absolute paths (`/var/…/photo.jpg`) — read from
|
|
19
|
+
* the file system. The result is cached in memory only; there is nothing
|
|
20
|
+
* to gain from copying a local file into the disk cache.
|
|
21
|
+
* - Android also accepts `content://` URIs and, from a release build's
|
|
22
|
+
* resources, a bare drawable name — which is what `require()` resolves to
|
|
23
|
+
* there. iOS resolves `require()` to a `file://` URL into the app bundle.
|
|
24
|
+
*
|
|
25
|
+
* A `require('./photo.png')` is resolved with `Image.resolveAssetSource`, so
|
|
26
|
+
* it works the same in debug (streamed from Metro) and release (bundled).
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Turns an {@linkcode ImageSource} into the URL string the native pipeline
|
|
31
|
+
* loads: strings pass through unchanged, a `require()`d asset is resolved via
|
|
32
|
+
* `Image.resolveAssetSource` (the scale-matched variant, like `<Image>`).
|
|
33
|
+
*
|
|
34
|
+
* The components and hooks call this for you; use it when calling
|
|
35
|
+
* `NitroImagePipeline.loadImage`/`preLoadImage` directly with a `require()`.
|
|
36
|
+
* @throws If `source` is a number that is not a registered asset.
|
|
37
|
+
* @example
|
|
38
|
+
* ```ts
|
|
39
|
+
* const image = await NitroImagePipeline.loadImage(
|
|
40
|
+
* resolveImageUrl(require('./photo.png')),
|
|
41
|
+
* { blur: 4 },
|
|
42
|
+
* );
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
function resolveImageUrl(source) {
|
|
46
|
+
if (typeof source === 'string') {
|
|
47
|
+
return source;
|
|
48
|
+
}
|
|
49
|
+
const resolved = _reactNative.Image.resolveAssetSource(source);
|
|
50
|
+
if (resolved == null) {
|
|
51
|
+
throw new Error(`Not a registered image asset: require() id ${source}`);
|
|
52
|
+
}
|
|
53
|
+
return resolved.uri;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* A URL no loader can resolve, standing in for a `require()` id that is not
|
|
58
|
+
* a registered asset. Its scheme has no fetcher on either platform, so the
|
|
59
|
+
* request fails at load time — the same way a missing file does — instead of
|
|
60
|
+
* throwing from a component's render.
|
|
61
|
+
*/
|
|
62
|
+
const UNREGISTERED_ASSET_URL = exports.UNREGISTERED_ASSET_URL = 'unregistered-asset://';
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* {@linkcode resolveImageUrl} for code that runs during render: an
|
|
66
|
+
* unregistered `require()` id yields {@linkcode UNREGISTERED_ASSET_URL} (and
|
|
67
|
+
* a warning in development) rather than throwing.
|
|
68
|
+
*/
|
|
69
|
+
function resolveImageUrlOrFallback(source) {
|
|
70
|
+
try {
|
|
71
|
+
return resolveImageUrl(source);
|
|
72
|
+
} catch (error) {
|
|
73
|
+
if (__DEV__) {
|
|
74
|
+
console.warn(`[react-native-nitro-image-pipeline] ${error.message}`);
|
|
75
|
+
}
|
|
76
|
+
return UNREGISTERED_ASSET_URL;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* A stable, per-source `recyclingKey` for `<NativeNitroImage>`: the URL
|
|
82
|
+
* itself for strings, and a tag derived from the asset id for a `require()`
|
|
83
|
+
* (resolving it would cost an asset-registry lookup per render for nothing
|
|
84
|
+
* more than a distinct key).
|
|
85
|
+
*/
|
|
86
|
+
function recyclingKeyFor(source) {
|
|
87
|
+
return typeof source === 'string' ? source : `asset:${source}`;
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=resolveImageSource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_reactNative","require","resolveImageUrl","source","resolved","RNImage","resolveAssetSource","Error","uri","UNREGISTERED_ASSET_URL","exports","resolveImageUrlOrFallback","error","__DEV__","console","warn","message","recyclingKeyFor"],"sourceRoot":"../../src","sources":["resolveImageSource.ts"],"mappings":";;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,eAAeA,CAACC,MAAmB,EAAU;EAC3D,IAAI,OAAOA,MAAM,KAAK,QAAQ,EAAE;IAC9B,OAAOA,MAAM;EACf;EACA,MAAMC,QAAQ,GAAGC,kBAAO,CAACC,kBAAkB,CAACH,MAAM,CAAC;EACnD,IAAIC,QAAQ,IAAI,IAAI,EAAE;IACpB,MAAM,IAAIG,KAAK,CAAC,8CAA8CJ,MAAM,EAAE,CAAC;EACzE;EACA,OAAOC,QAAQ,CAACI,GAAG;AACrB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,sBAAsB,GAAAC,OAAA,CAAAD,sBAAA,GAAG,uBAAuB;;AAE7D;AACA;AACA;AACA;AACA;AACO,SAASE,yBAAyBA,CAACR,MAAmB,EAAU;EACrE,IAAI;IACF,OAAOD,eAAe,CAACC,MAAM,CAAC;EAChC,CAAC,CAAC,OAAOS,KAAK,EAAE;IACd,IAAIC,OAAO,EAAE;MACXC,OAAO,CAACC,IAAI,CACV,uCAAwCH,KAAK,CAAWI,OAAO,EACjE,CAAC;IACH;IACA,OAAOP,sBAAsB;EAC/B;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAASQ,eAAeA,CAACd,MAAmB,EAAU;EAC3D,OAAO,OAAOA,MAAM,KAAK,QAAQ,GAAGA,MAAM,GAAG,SAASA,MAAM,EAAE;AAChE","ignoreList":[]}
|
package/lib/commonjs/useImage.js
CHANGED
|
@@ -6,12 +6,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.useImage = useImage;
|
|
7
7
|
var _react = require("react");
|
|
8
8
|
var _NitroImagePipeline = require("./NitroImagePipeline");
|
|
9
|
+
var _resolveImageSource = require("./resolveImageSource");
|
|
9
10
|
/**
|
|
10
|
-
* A hook to asynchronously load an image from the
|
|
11
|
-
*
|
|
11
|
+
* A hook to asynchronously load an image from `url` through the pipeline
|
|
12
|
+
* into memory.
|
|
12
13
|
* @example
|
|
13
14
|
* ```ts
|
|
14
|
-
* const { image, error } = useImage({
|
|
15
|
+
* const { image, error } = useImage({ url: 'https://example.com/photo.jpg' });
|
|
16
|
+
* const { image: logo } = useImage({ url: require('./logo.png') });
|
|
15
17
|
* ```
|
|
16
18
|
*/
|
|
17
19
|
function useImage({
|
|
@@ -55,7 +57,9 @@ function useImage({
|
|
|
55
57
|
if (enabled) {
|
|
56
58
|
(async () => {
|
|
57
59
|
try {
|
|
58
|
-
|
|
60
|
+
// Resolved inside the try so an unregistered `require()` id
|
|
61
|
+
// surfaces as the error state instead of throwing from the effect.
|
|
62
|
+
const result = await _NitroImagePipeline.NitroImagePipeline.loadImage((0, _resolveImageSource.resolveImageUrl)(url), {
|
|
59
63
|
blur,
|
|
60
64
|
cornerRadius: isUniformRadius ? uniformRadius : {
|
|
61
65
|
topLeft,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","_NitroImagePipeline","useImage","url","blur","cornerRadius","resize","cache","enabled","image","setImage","useState","undefined","error","loadedUrlRef","useRef","isUniformRadius","uniformRadius","topLeft","topRight","bottomLeft","bottomRight","resizeWidth","width","resizeHeight","height","useEffect","cancelled","current","result","NitroImagePipeline","loadImage","e","Error"],"sourceRoot":"../../src","sources":["useImage.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAGA,IAAAC,mBAAA,GAAAD,OAAA;AAwBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,
|
|
1
|
+
{"version":3,"names":["_react","require","_NitroImagePipeline","_resolveImageSource","useImage","url","blur","cornerRadius","resize","cache","enabled","image","setImage","useState","undefined","error","loadedUrlRef","useRef","isUniformRadius","uniformRadius","topLeft","topRight","bottomLeft","bottomRight","resizeWidth","width","resizeHeight","height","useEffect","cancelled","current","result","NitroImagePipeline","loadImage","resolveImageUrl","e","Error"],"sourceRoot":"../../src","sources":["useImage.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAGA,IAAAC,mBAAA,GAAAD,OAAA;AACA,IAAAE,mBAAA,GAAAF,OAAA;AAwBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASG,QAAQA,CAAC;EACvBC,GAAG;EACHC,IAAI,GAAG,CAAC;EACRC,YAAY,GAAG,CAAC;EAChBC,MAAM;EACNC,KAAK;EACLC,OAAO,GAAG;AAmCZ,CAAC,EAAU;EACT,MAAM,CAACC,KAAK,EAAEC,QAAQ,CAAC,GAAG,IAAAC,eAAQ,EAAS;IACzCF,KAAK,EAAEG,SAAS;IAChBC,KAAK,EAAED;EACT,CAAC,CAAC;EACF,MAAME,YAAY,GAAG,IAAAC,aAAM,EAACZ,GAAG,CAAC;;EAEhC;EACA;EACA,MAAMa,eAAe,GAAG,OAAOX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pB,KAAK,GAAGoB,CAAC,YAAYC,KAAK,GAAGD,CAAC,GAAG,IAAIC,KAAK,CAAC,GAAGD,CAAC,EAAE,CAAC;UACxD,IAAI,CAACN,SAAS,EAAE;YACdjB,QAAQ,CAAC;cAAED,KAAK,EAAEG,SAAS;cAAEC,KAAK,EAAEA;YAAM,CAAC,CAAC;UAC9C;QACF;MACF,CAAC,EAAE,CAAC;IACN;IAEA,OAAO,MAAM;MACXc,SAAS,GAAG,IAAI;IAClB,CAAC;EACH,CAAC,EAAE,CACDxB,GAAG,EACHC,IAAI,EACJY,eAAe,EACfC,aAAa,EACbC,OAAO,EACPC,QAAQ,EACRC,UAAU,EACVC,WAAW,EACXC,WAAW,EACXE,YAAY,EACZjB,KAAK,EACLC,OAAO,CACR,CAAC;EAEF,OAAOC,KAAK;AACd","ignoreList":[]}
|
|
@@ -6,8 +6,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.usePipelineImageLoader = usePipelineImageLoader;
|
|
7
7
|
var _react = require("react");
|
|
8
8
|
var _NitroImagePipeline = require("./NitroImagePipeline");
|
|
9
|
+
var _resolveImageSource = require("./resolveImageSource");
|
|
9
10
|
/**
|
|
10
|
-
* Creates (and memoizes) an {@linkcode ImageLoader} for `
|
|
11
|
+
* Creates (and memoizes) an {@linkcode ImageLoader} for `source` — a URL
|
|
12
|
+
* string or a `require()`d asset, see {@linkcode ImageSource} — to pass to
|
|
11
13
|
* `<NativeNitroImage image={...} />`. The view drives it entirely natively:
|
|
12
14
|
* the request starts when the view attaches — at the view's laid-out size,
|
|
13
15
|
* with no JS round trips — and is cancelled when it detaches. See
|
|
@@ -17,7 +19,7 @@ var _NitroImagePipeline = require("./NitroImagePipeline");
|
|
|
17
19
|
* bitmap pixels); the screen scale is applied natively. Inline object
|
|
18
20
|
* literals are fine — options are compared by value, not identity.
|
|
19
21
|
*/
|
|
20
|
-
function usePipelineImageLoader(
|
|
22
|
+
function usePipelineImageLoader(source, options) {
|
|
21
23
|
// Split the options into primitives (like useImage does) so an inline
|
|
22
24
|
// literal — a new identity every render — doesn't recreate the loader;
|
|
23
25
|
// recreating it would re-trigger the native load.
|
|
@@ -36,6 +38,9 @@ function usePipelineImageLoader(url, options) {
|
|
|
36
38
|
const resizeWidth = options?.resize?.width;
|
|
37
39
|
const resizeHeight = options?.resize?.height;
|
|
38
40
|
return (0, _react.useMemo)(() => {
|
|
41
|
+
// Runs during render, so an unregistered `require()` id must not throw:
|
|
42
|
+
// it becomes a URL the native loader fails on at load time instead.
|
|
43
|
+
const url = (0, _resolveImageSource.resolveImageUrlOrFallback)(source);
|
|
39
44
|
const cornerRadiusOption = isUniformRadius ? uniformRadius : hasCornerObject ? {
|
|
40
45
|
topLeft,
|
|
41
46
|
topRight,
|
|
@@ -64,6 +69,6 @@ function usePipelineImageLoader(url, options) {
|
|
|
64
69
|
}
|
|
65
70
|
});
|
|
66
71
|
return loader;
|
|
67
|
-
}, [
|
|
72
|
+
}, [source, blur, cache, isUniformRadius, uniformRadius, hasCornerObject, topLeft, topRight, bottomLeft, bottomRight, resizeWidth, resizeHeight]);
|
|
68
73
|
}
|
|
69
74
|
//# sourceMappingURL=usePipelineImageLoader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","_NitroImagePipeline","usePipelineImageLoader","
|
|
1
|
+
{"version":3,"names":["_react","require","_NitroImagePipeline","_resolveImageSource","usePipelineImageLoader","source","options","blur","cache","cornerRadius","isUniformRadius","uniformRadius","hasCornerObject","undefined","topLeft","topRight","bottomLeft","bottomRight","resizeWidth","resize","width","resizeHeight","height","useMemo","url","resolveImageUrlOrFallback","cornerRadiusOption","stableOptions","loader","NitroImagePipeline","createImageLoader","Object","defineProperty","enumerable","configurable","value"],"sourceRoot":"../../src","sources":["usePipelineImageLoader.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAGA,IAAAC,mBAAA,GAAAD,OAAA;AACA,IAAAE,mBAAA,GAAAF,O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ACD,MAAMe,MAAM,GAAGC,sCAAkB,CAACC,iBAAiB,CAACN,GAAG,EAAEG,aAAa,CAAC;IACvE;IACA;IACA;IACAI,MAAM,CAACC,cAAc,CAACJ,MAAM,EAAE,UAAU,EAAE;MACxCK,UAAU,EAAE,IAAI;MAChBC,YAAY,EAAE,IAAI;MAClBC,KAAK,EAAE;QAAEX,GAAG;QAAElB,OAAO,EAAEqB;MAAc;IACvC,CAAC,CAAC;IACF,OAAOC,MAAM;EACf,CAAC,EAAE,CACDvB,MAAM,EACNE,IAAI,EACJC,KAAK,EACLE,eAAe,EACfC,aAAa,EACbC,eAAe,EACfE,OAAO,EACPC,QAAQ,EACRC,UAAU,EACVC,WAAW,EACXC,WAAW,EACXG,YAAY,CACb,CAAC;AACJ","ignoreList":[]}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import { forwardRef } from 'react';
|
|
4
4
|
import { NativeNitroImage } from 'react-native-nitro-image';
|
|
5
5
|
import { cornerRadiusForStyle } from './resizeForStyle';
|
|
6
|
+
import { recyclingKeyFor } from './resolveImageSource';
|
|
6
7
|
import { usePipelineImageLoader } from './usePipelineImageLoader';
|
|
7
8
|
|
|
8
9
|
/**
|
|
@@ -53,7 +54,7 @@ export const NativePipelineImage = /*#__PURE__*/forwardRef(function NativePipeli
|
|
|
53
54
|
return /*#__PURE__*/_jsx(NativeNitroImage
|
|
54
55
|
// Before the spread so a caller-provided recyclingKey wins.
|
|
55
56
|
, {
|
|
56
|
-
recyclingKey: url,
|
|
57
|
+
recyclingKey: recyclingKeyFor(url),
|
|
57
58
|
...viewProps,
|
|
58
59
|
ref: ref,
|
|
59
60
|
style: style,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["forwardRef","NativeNitroImage","cornerRadiusForStyle","usePipelineImageLoader","jsx","_jsx","NativePipelineImage","url","blur","cornerRadius","cache","resize","style","viewProps","ref","effectiveCornerRadius","loader","recyclingKey","image","displayName"],"sourceRoot":"../../src","sources":["NativePipelineImage.tsx"],"mappings":";;AAAA,SAA4BA,UAAU,QAAQ,OAAO;AAErD,SAASC,gBAAgB,QAAQ,0BAA0B;AAE3D,SAASC,oBAAoB,QAAQ,kBAAkB;
|
|
1
|
+
{"version":3,"names":["forwardRef","NativeNitroImage","cornerRadiusForStyle","recyclingKeyFor","usePipelineImageLoader","jsx","_jsx","NativePipelineImage","url","blur","cornerRadius","cache","resize","style","viewProps","ref","effectiveCornerRadius","loader","recyclingKey","image","displayName"],"sourceRoot":"../../src","sources":["NativePipelineImage.tsx"],"mappings":";;AAAA,SAA4BA,UAAU,QAAQ,OAAO;AAErD,SAASC,gBAAgB,QAAQ,0BAA0B;AAE3D,SAASC,oBAAoB,QAAQ,kBAAkB;AACvD,SAA2BC,eAAe,QAAQ,sBAAsB;AAMxE,SAASC,sBAAsB,QAAQ,0BAA0B;;AAKjE;AACA;AACA;AACA;AACA;AAJA,SAAAC,GAAA,IAAAC,IAAA;AAuCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,mBAAmB,gBAAGP,UAAU,CAG3C,SAASO,mBAAmBA,CAC5B;EAAEC,GAAG;EAAEC,IAAI;EAAEC,YAAY;EAAEC,KAAK;EAAEC,MAAM;EAAEC,KAAK;EAAE,GAAGC;AAAU,CAAC,EAC/DC,GAAG,EACH;EACA;EACA,MAAMC,qBAAqB,GAAGN,YAAY,IAAIR,oBAAoB,CAACW,KAAK,CAAC;EACzE,MAAMI,MAAM,GAAGb,sBAAsB,CAACI,GAAG,EAAE;IACzCC,IAAI;IACJC,YAAY,EAAEM,qBAAqB;IACnCL,KAAK;IACLC;EACF,CAAC,CAAC;EAEF,oBACEN,IAAA,CAACL;EACC;EAAA;IACAiB,YAAY,EAAEf,eAAe,CAACK,GAAG,CAAE;IAAA,GAC/BM,SAAS;IACbC,GAAG,EAAEA,GAAI;IACTF,KAAK,EAAEA,KAAM;IACbM,KAAK,EAAEF;EAAO,CACf,CAAC;AAEN,CAAC,CAAC;;AAEF;AACA;AACAV,mBAAmB,CAACa,WAAW,GAAG,qBAAqB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["forwardRef","useEffect","useRef","useState","PixelRatio","NativeNitroImage","cornerRadiusForStyle","resizeForLayout","resizeForStyle","useImage","jsx","_jsx","sameSize","a","b","width","height","scaleRadius","cornerRadius","scale","topLeft","topRight","bottomLeft","bottomRight","PipelineImage","url","blur","cache","onLoad","onError","style","onLayout","viewProps","ref","get","styleSize","layoutSize","setLayoutSize","undefined","resize","effectiveCornerRadius","image","error","enabled","onLoadRef","onErrorRef","current","handleLayout","event","nativeEvent","layout","next","prev","displayName"],"sourceRoot":"../../src","sources":["PipelineImage.tsx"],"mappings":";;AAAA,SAEEA,UAAU,EACVC,SAAS,EACTC,MAAM,EACNC,QAAQ,QACH,OAAO;AACd,SAGEC,UAAU,QACL,cAAc;AACrB,SAAqBC,gBAAgB,QAAQ,0BAA0B;AAEvE,SACEC,oBAAoB,EACpBC,eAAe,EACfC,cAAc,QACT,kBAAkB;
|
|
1
|
+
{"version":3,"names":["forwardRef","useEffect","useRef","useState","PixelRatio","NativeNitroImage","cornerRadiusForStyle","resizeForLayout","resizeForStyle","useImage","jsx","_jsx","sameSize","a","b","width","height","scaleRadius","cornerRadius","scale","topLeft","topRight","bottomLeft","bottomRight","PipelineImage","url","blur","cache","onLoad","onError","style","onLayout","viewProps","ref","get","styleSize","layoutSize","setLayoutSize","undefined","resize","effectiveCornerRadius","image","error","enabled","onLoadRef","onErrorRef","current","handleLayout","event","nativeEvent","layout","next","prev","displayName"],"sourceRoot":"../../src","sources":["PipelineImage.tsx"],"mappings":";;AAAA,SAEEA,UAAU,EACVC,SAAS,EACTC,MAAM,EACNC,QAAQ,QACH,OAAO;AACd,SAGEC,UAAU,QACL,cAAc;AACrB,SAAqBC,gBAAgB,QAAQ,0BAA0B;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I,IAAMxC,QAAQ,CAACwC,IAAI,EAAED,IAAI,CAAC,GAAGC,IAAI,GAAGD,IAAK,CAAC;EAC/D,CAAC;EAED,oBACExC,IAAA,CAACN,gBAAgB;IAAA,GACX2B,SAAS;IACbC,GAAG,EAAEA,GAAI;IACTH,KAAK,EAAEA,KAAM;IACbC,QAAQ,EAAEgB,YAAa;IACvBN,KAAK,EAAEA;EAAM,CACd,CAAC;AAEN,CACF,CAAC;;AAED;AACA;AACAjB,aAAa,CAAC6B,WAAW,GAAG,eAAe","ignoreList":[]}
|
package/lib/module/index.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
export { NativePipelineImage } from './NativePipelineImage';
|
|
4
4
|
export { NitroImagePipeline } from './NitroImagePipeline';
|
|
5
5
|
export { PipelineImage } from './PipelineImage';
|
|
6
|
+
export { resolveImageUrl, UNREGISTERED_ASSET_URL } from './resolveImageSource';
|
|
6
7
|
export { cornerRadiusForStyle, resizeForLayout, resizeForStyle } from './resizeForStyle';
|
|
7
8
|
export { useImage } from './useImage';
|
|
8
9
|
export { usePipelineImageLoader } from './usePipelineImageLoader';
|