react-native-nitro-image-pipeline 1.5.0 → 1.7.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.
Files changed (87) hide show
  1. package/README.md +142 -18
  2. package/android/src/main/java/com/margelo/nitro/nitroimagepipeline/HybridNitroImagePipeline.kt +72 -16
  3. package/android/src/main/java/com/margelo/nitro/nitroimagepipeline/PipelineImageLoader.kt +47 -8
  4. package/android/src/main/java/com/margelo/nitro/nitroimagepipeline/transform/FitGeometry.kt +104 -0
  5. package/android/src/main/java/com/margelo/nitro/nitroimagepipeline/transform/PipelineRoundedCornersTransformation.kt +103 -0
  6. package/android/src/main/java/com/margelo/nitro/nitroimagepipeline/transform/ResizeTransformation.kt +69 -16
  7. package/ios/FitResizeProcessor.swift +127 -0
  8. package/ios/HybridNitroImagePipeline.swift +88 -24
  9. package/ios/PipelineImageLoader.swift +108 -18
  10. package/lib/commonjs/NativePipelineImage.js +20 -4
  11. package/lib/commonjs/NativePipelineImage.js.map +1 -1
  12. package/lib/commonjs/PipelineImage.js +13 -1
  13. package/lib/commonjs/PipelineImage.js.map +1 -1
  14. package/lib/commonjs/index.js +13 -0
  15. package/lib/commonjs/index.js.map +1 -1
  16. package/lib/commonjs/resizeForStyle.js +3 -1
  17. package/lib/commonjs/resizeForStyle.js.map +1 -1
  18. package/lib/commonjs/resolveImageSource.js +89 -0
  19. package/lib/commonjs/resolveImageSource.js.map +1 -0
  20. package/lib/commonjs/useImage.js +14 -6
  21. package/lib/commonjs/useImage.js.map +1 -1
  22. package/lib/commonjs/usePipelineImageLoader.js +114 -11
  23. package/lib/commonjs/usePipelineImageLoader.js.map +1 -1
  24. package/lib/module/NativePipelineImage.js +20 -4
  25. package/lib/module/NativePipelineImage.js.map +1 -1
  26. package/lib/module/PipelineImage.js +13 -1
  27. package/lib/module/PipelineImage.js.map +1 -1
  28. package/lib/module/index.js +1 -0
  29. package/lib/module/index.js.map +1 -1
  30. package/lib/module/resizeForStyle.js +3 -1
  31. package/lib/module/resizeForStyle.js.map +1 -1
  32. package/lib/module/resolveImageSource.js +83 -0
  33. package/lib/module/resolveImageSource.js.map +1 -0
  34. package/lib/module/useImage.js +14 -6
  35. package/lib/module/useImage.js.map +1 -1
  36. package/lib/module/usePipelineImageLoader.js +115 -12
  37. package/lib/module/usePipelineImageLoader.js.map +1 -1
  38. package/lib/typescript/src/NativePipelineImage.d.ts +51 -5
  39. package/lib/typescript/src/NativePipelineImage.d.ts.map +1 -1
  40. package/lib/typescript/src/PipelineImage.d.ts +35 -3
  41. package/lib/typescript/src/PipelineImage.d.ts.map +1 -1
  42. package/lib/typescript/src/index.d.ts +2 -1
  43. package/lib/typescript/src/index.d.ts.map +1 -1
  44. package/lib/typescript/src/resizeForStyle.d.ts +3 -1
  45. package/lib/typescript/src/resizeForStyle.d.ts.map +1 -1
  46. package/lib/typescript/src/resolveImageSource.d.ts +56 -0
  47. package/lib/typescript/src/resolveImageSource.d.ts.map +1 -0
  48. package/lib/typescript/src/specs/nitro-image-toolkit.nitro.d.ts +95 -8
  49. package/lib/typescript/src/specs/nitro-image-toolkit.nitro.d.ts.map +1 -1
  50. package/lib/typescript/src/useImage.d.ts +13 -6
  51. package/lib/typescript/src/useImage.d.ts.map +1 -1
  52. package/lib/typescript/src/usePipelineImageLoader.d.ts +7 -3
  53. package/lib/typescript/src/usePipelineImageLoader.d.ts.map +1 -1
  54. package/nitrogen/generated/android/NitroImagePipelineOnLoad.cpp +4 -0
  55. package/nitrogen/generated/android/c++/JFunc_void_double_double.hpp +75 -0
  56. package/nitrogen/generated/android/c++/JFunc_void_std__string.hpp +76 -0
  57. package/nitrogen/generated/android/c++/JHybridNitroImagePipelineSpec.cpp +8 -0
  58. package/nitrogen/generated/android/c++/JOptions.hpp +2 -0
  59. package/nitrogen/generated/android/c++/JResizeFit.hpp +64 -0
  60. package/nitrogen/generated/android/c++/JResizeOptions.hpp +14 -4
  61. package/nitrogen/generated/android/c++/JViewOptions.hpp +42 -3
  62. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroimagepipeline/Func_void_double_double.kt +78 -0
  63. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroimagepipeline/Func_void_std__string.kt +78 -0
  64. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroimagepipeline/ResizeFit.kt +25 -0
  65. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroimagepipeline/ResizeOptions.kt +14 -4
  66. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroimagepipeline/ViewOptions.kt +29 -5
  67. package/nitrogen/generated/ios/NitroImagePipeline-Swift-Cxx-Bridge.cpp +16 -0
  68. package/nitrogen/generated/ios/NitroImagePipeline-Swift-Cxx-Bridge.hpp +107 -0
  69. package/nitrogen/generated/ios/NitroImagePipeline-Swift-Cxx-Umbrella.hpp +4 -0
  70. package/nitrogen/generated/ios/c++/HybridNitroImagePipelineSpecSwift.hpp +4 -0
  71. package/nitrogen/generated/ios/swift/Func_void_double_double.swift +46 -0
  72. package/nitrogen/generated/ios/swift/Func_void_std__string.swift +46 -0
  73. package/nitrogen/generated/ios/swift/ResizeFit.swift +48 -0
  74. package/nitrogen/generated/ios/swift/ResizeOptions.swift +31 -2
  75. package/nitrogen/generated/ios/swift/ViewOptions.swift +82 -1
  76. package/nitrogen/generated/shared/c++/ResizeFit.hpp +84 -0
  77. package/nitrogen/generated/shared/c++/ResizeOptions.hpp +14 -4
  78. package/nitrogen/generated/shared/c++/ViewOptions.hpp +24 -3
  79. package/package.json +1 -1
  80. package/src/NativePipelineImage.tsx +75 -6
  81. package/src/PipelineImage.tsx +46 -3
  82. package/src/index.ts +6 -0
  83. package/src/resizeForStyle.ts +3 -1
  84. package/src/resolveImageSource.ts +83 -0
  85. package/src/specs/nitro-image-toolkit.nitro.ts +96 -8
  86. package/src/useImage.ts +38 -17
  87. package/src/usePipelineImageLoader.ts +126 -11
@@ -21,6 +21,11 @@ import UIKit
21
21
  /// `ViewOptions` values are in points; this class converts them to the
22
22
  /// pixel-based `Options` of the shared request builder using the view's
23
23
  /// display scale, so cache keys match an equivalent `loadImage` call.
24
+ ///
25
+ /// The optional `onLoad`/`onError` callbacks report a view's load back to JS.
26
+ /// They are per request, not per loader: several views (and a recycled cell
27
+ /// re-attaching) each call them, and a view that requests twice reports twice.
28
+ /// `loadImage()` doesn't — it reports through its promise instead.
24
29
  class PipelineImageLoader: HybridImageLoaderSpec {
25
30
  private let url: String
26
31
  private let options: ViewOptions?
@@ -30,6 +35,14 @@ class PipelineImageLoader: HybridImageLoaderSpec {
30
35
  // to the main thread — every access happens inside a main-queue block.
31
36
  private var tasks: [ObjectIdentifier: Task<Void, Never>] = [:]
32
37
  private var pendingLayouts: [ObjectIdentifier: NSKeyValueObservation] = [:]
38
+ // Bumped synchronously by every `requestImage`/`dropImage` — the view
39
+ // calls both on the main thread, from its own lifecycle — so work queued
40
+ // by an earlier call can tell a later one superseded it before its
41
+ // main-queue block ran, and neither displays nor reports. `dropImage`
42
+ // only *queues* its cancellation, so without this a request queued just
43
+ // before a detach still runs first and, on a memory-cache hit, reports a
44
+ // load for a view that is about to be cleared.
45
+ private var generations: [ObjectIdentifier: Int] = [:]
33
46
 
34
47
  init(url: String, options: ViewOptions?) {
35
48
  self.url = url
@@ -55,7 +68,9 @@ class PipelineImageLoader: HybridImageLoaderSpec {
55
68
  }
56
69
 
57
70
  /// The point-based `ViewOptions` as pixel-based `Options`, resolved
58
- /// against `scale` and the target size in pixels.
71
+ /// against `scale` and the target size in pixels. The fit comes from the
72
+ /// explicit `resize` when it carries one, else from the top-level
73
+ /// `fit`/`allowUpscale`, which apply to the measured size.
59
74
  private func pixelOptions(scale: CGFloat, sizePx: CGSize?) -> Options {
60
75
  let cornerRadius = options?.cornerRadius.map { radius -> Variant_Double_CornerRadii in
61
76
  switch radius {
@@ -74,23 +89,50 @@ class PipelineImageLoader: HybridImageLoaderSpec {
74
89
  blur: options?.blur.map { $0 * scale },
75
90
  cache: options?.cache,
76
91
  cornerRadius: cornerRadius,
77
- resize: sizePx.map { ResizeOptions(width: Double($0.width), height: Double($0.height)) }
92
+ resize: sizePx.map {
93
+ ResizeOptions(
94
+ width: Double($0.width),
95
+ height: Double($0.height),
96
+ fit: explicitResizeOptions?.fit ?? options?.fit,
97
+ allowUpscale: explicitResizeOptions?.allowUpscale ?? options?.allowUpscale
98
+ )
99
+ }
78
100
  )
79
101
  }
80
102
 
81
- /// An explicit `resize` override (pixels), when set and valid.
82
- private var explicitResize: CGSize? {
103
+ /// The loaded image as the view should draw it. The pipeline decodes at
104
+ /// scale 1 (1 pt = 1 px); `.center` — the one content mode that draws an
105
+ /// image at its point size — would then show a `fit: 'center'` bitmap at
106
+ /// `scale`× its size on a Retina screen, while Android's
107
+ /// `ScaleType.CENTER` draws it pixel for pixel. Re-wrapping with the
108
+ /// display scale (a wrapper around the same CGImage, not a copy) makes
109
+ /// iOS draw 1 bitmap pixel per device pixel too; the scaling content
110
+ /// modes are unaffected by an image's scale.
111
+ private static func displayImage(_ image: UIImage, scale: CGFloat) -> UIImage {
112
+ guard image.scale != scale, let cgImage = image.cgImage else { return image }
113
+ return UIImage(cgImage: cgImage, scale: scale, orientation: image.imageOrientation)
114
+ }
115
+
116
+ /// The explicit `resize` override, when set and valid. An invalid one
117
+ /// (a non-positive dimension) is ignored as a whole — its `fit` and
118
+ /// `allowUpscale` included, as on Android — and the view is measured.
119
+ private var explicitResizeOptions: ResizeOptions? {
83
120
  guard let resize = options?.resize, resize.width > 0, resize.height > 0 else {
84
121
  return nil
85
122
  }
86
- return CGSize(width: resize.width, height: resize.height)
123
+ return resize
124
+ }
125
+
126
+ /// The explicit `resize` override's size (pixels), when set and valid.
127
+ private var explicitResize: CGSize? {
128
+ explicitResizeOptions.map { CGSize(width: $0.width, height: $0.height) }
87
129
  }
88
130
 
89
131
  // MARK: - ImageLoader
90
132
 
91
133
  func loadImage() throws -> Promise<any HybridImageSpec> {
92
134
  return Promise.async {
93
- guard let imageUrl = URL(string: self.url) else {
135
+ guard let imageUrl = HybridNitroImagePipeline.url(from: self.url) else {
94
136
  throw RuntimeError.error(withMessage: "Invalid URL: \(self.url)")
95
137
  }
96
138
  // No view to measure here: use the explicit resize if given, and
@@ -108,17 +150,22 @@ class PipelineImageLoader: HybridImageLoaderSpec {
108
150
  func requestImage(forView view: any HybridNitroImageViewSpec) throws {
109
151
  guard let nativeView = view as? NativeImageView else { return }
110
152
  let key = ObjectIdentifier(view)
153
+ let generation = supersedeWork(for: key)
111
154
  // Always hop (asynchronously) to main: `requestImage` fires while the
112
155
  // view is being mounted, and only after the current mounting
113
156
  // transaction finishes is its final frame guaranteed to be set.
114
157
  DispatchQueue.main.async {
115
- self.load(into: nativeView.imageView, key: key)
158
+ guard self.isCurrent(generation, for: key) else { return }
159
+ self.load(into: nativeView.imageView, key: key, generation: generation)
116
160
  }
117
161
  }
118
162
 
119
163
  func dropImage(forView view: any HybridNitroImageViewSpec) throws {
120
164
  guard let nativeView = view as? NativeImageView else { return }
121
165
  let key = ObjectIdentifier(view)
166
+ // Takes effect now, unlike the cancellation below: a request queued
167
+ // before this drop runs first, and must not load or report.
168
+ _ = supersedeWork(for: key)
122
169
  // Same queue as `requestImage`, so rapid attach/detach sequences
123
170
  // (list recycling) replay in call order.
124
171
  DispatchQueue.main.async {
@@ -129,6 +176,20 @@ class PipelineImageLoader: HybridImageLoaderSpec {
129
176
 
130
177
  // MARK: - Main-thread loading
131
178
 
179
+ /// Invalidates whatever is queued for `key` and returns the token
180
+ /// identifying this new piece of work. Main thread, like its callers.
181
+ private func supersedeWork(for key: ObjectIdentifier) -> Int {
182
+ // Never reset: a token must not be reused while an older block that
183
+ // holds it is still queued.
184
+ let generation = (generations[key] ?? 0) + 1
185
+ generations[key] = generation
186
+ return generation
187
+ }
188
+
189
+ private func isCurrent(_ generation: Int, for key: ObjectIdentifier) -> Bool {
190
+ return generations[key] == generation
191
+ }
192
+
132
193
  private func cancel(key: ObjectIdentifier) {
133
194
  tasks[key]?.cancel()
134
195
  tasks[key] = nil
@@ -136,18 +197,18 @@ class PipelineImageLoader: HybridImageLoaderSpec {
136
197
  pendingLayouts[key] = nil
137
198
  }
138
199
 
139
- private func load(into imageView: UIImageView, key: ObjectIdentifier) {
200
+ private func load(into imageView: UIImageView, key: ObjectIdentifier, generation: Int) {
140
201
  cancel(key: key)
141
202
 
142
203
  if let sizePx = explicitResize {
143
- start(into: imageView, key: key, sizePx: sizePx)
204
+ start(into: imageView, key: key, generation: generation, sizePx: sizePx)
144
205
  return
145
206
  }
146
207
 
147
208
  let bounds = imageView.bounds.size
148
209
  if bounds.width > 0, bounds.height > 0 {
149
210
  let scale = Self.displayScale(of: imageView)
150
- start(into: imageView, key: key, sizePx: CGSize(
211
+ start(into: imageView, key: key, generation: generation, sizePx: CGSize(
151
212
  width: bounds.width * scale,
152
213
  height: bounds.height * scale
153
214
  ))
@@ -160,14 +221,26 @@ class PipelineImageLoader: HybridImageLoaderSpec {
160
221
  DispatchQueue.main.async {
161
222
  guard let self, let imageView else { return }
162
223
  guard self.pendingLayouts[key] != nil else { return }
163
- self.load(into: imageView, key: key)
224
+ guard self.isCurrent(generation, for: key) else { return }
225
+ self.load(into: imageView, key: key, generation: generation)
164
226
  }
165
227
  }
166
228
  }
167
229
  }
168
230
 
169
- private func start(into imageView: UIImageView, key: ObjectIdentifier, sizePx: CGSize) {
170
- guard let imageUrl = URL(string: url) else { return }
231
+ private func start(
232
+ into imageView: UIImageView,
233
+ key: ObjectIdentifier,
234
+ generation: Int,
235
+ sizePx: CGSize
236
+ ) {
237
+ guard let imageUrl = HybridNitroImagePipeline.url(from: url) else {
238
+ // Android's loader hands a malformed URL to Coil, which reports it
239
+ // as a failed request; report it here too rather than returning
240
+ // silently and leaving `onError` waiting forever.
241
+ options?.onError?("Invalid URL: \(url)")
242
+ return
243
+ }
171
244
  let scale = Self.displayScale(of: imageView)
172
245
  let request = HybridNitroImagePipeline.makeRequest(
173
246
  url: imageUrl,
@@ -181,15 +254,32 @@ class PipelineImageLoader: HybridImageLoaderSpec {
181
254
  // bitmap is already in memory. The subscript honours the request's
182
255
  // `.disableMemoryCacheReads`, so `cache: 'disk'`/`'none'` still miss.
183
256
  if !request.options.contains(.disableMemoryCacheReads), let cached = pipeline.cache[request] {
184
- imageView.image = cached.image
257
+ imageView.image = Self.displayImage(cached.image, scale: scale)
258
+ notifyLoad(cached.image)
185
259
  return
186
260
  }
187
261
  // Cancelling the Task cancels Nuke's request; a finished task stays in
188
262
  // the map (cancelling it is a no-op) until `cancel` replaces it.
189
- tasks[key] = Task { @MainActor [weak imageView] in
190
- guard let image = try? await pipeline.image(for: request) else { return }
191
- guard !Task.isCancelled else { return }
192
- imageView?.image = image
263
+ tasks[key] = Task { @MainActor [weak self, weak imageView] in
264
+ do {
265
+ let image = try await pipeline.image(for: request)
266
+ guard !Task.isCancelled else { return }
267
+ guard self?.isCurrent(generation, for: key) == true else { return }
268
+ imageView?.image = Self.displayImage(image, scale: scale)
269
+ self?.notifyLoad(image)
270
+ } catch {
271
+ // A load the view cancelled by detaching is not a failure.
272
+ guard !Task.isCancelled, !(error is CancellationError) else { return }
273
+ guard self?.isCurrent(generation, for: key) == true else { return }
274
+ self?.options?.onError?(error.localizedDescription)
275
+ }
193
276
  }
194
277
  }
278
+
279
+ /// Reports the displayed bitmap's size in pixels, when the caller asked
280
+ /// for it. `UIImage.size` is in points, so it needs the image's own scale.
281
+ private func notifyLoad(_ image: UIImage) {
282
+ guard let onLoad = options?.onLoad else { return }
283
+ onLoad(image.size.width * image.scale, image.size.height * image.scale)
284
+ }
195
285
  }
@@ -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
  /**
@@ -24,8 +25,9 @@ var _jsxRuntime = require("react/jsx-runtime");
24
25
  * the same pipeline and caches as `useImage`/`preLoadImage`.
25
26
  *
26
27
  * Compared to `PipelineImage`:
27
- * - No `onLoad`/`onError` callbacks the loaded `Image` never crosses into
28
- * JS. Use `PipelineImage` (or `useImage`) when you need them.
28
+ * - `onLoad` reports the bitmap's pixel size rather than the `Image` itself,
29
+ * which never crosses into JS, and can fire more than once for a view. Use
30
+ * `PipelineImage` (or `useImage`) when you need the `Image`.
29
31
  * - The bitmap is loaded once at the size the view first has; if the view is
30
32
  * resized later, the bitmap scales with it instead of reloading.
31
33
  * @example
@@ -43,24 +45,38 @@ const NativePipelineImage = exports.NativePipelineImage = /*#__PURE__*/(0, _reac
43
45
  cornerRadius,
44
46
  cache,
45
47
  resize,
48
+ fit,
49
+ allowUpscale,
50
+ onLoad,
51
+ onError,
46
52
  style,
53
+ resizeMode,
47
54
  ...viewProps
48
55
  }, ref) {
49
56
  // Same precedence as PipelineImage: an explicit prop wins over style.
50
57
  const effectiveCornerRadius = cornerRadius ?? (0, _resizeForStyle.cornerRadiusForStyle)(style);
58
+ // Inline arrows are fine here — the hook keeps the callbacks in a ref, so a
59
+ // new identity doesn't recreate the loader (which would reload the image).
51
60
  const loader = (0, _usePipelineImageLoader.usePipelineImageLoader)(url, {
52
61
  blur,
53
62
  cornerRadius: effectiveCornerRadius,
54
63
  cache,
55
- resize
64
+ resize,
65
+ // Same four values as the view's resizeMode; an explicit `fit` decouples
66
+ // them.
67
+ fit: fit ?? resizeMode,
68
+ allowUpscale,
69
+ onLoad,
70
+ onError
56
71
  });
57
72
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeNitroImage.NativeNitroImage
58
73
  // Before the spread so a caller-provided recyclingKey wins.
59
74
  , {
60
- recyclingKey: url,
75
+ recyclingKey: (0, _resolveImageSource.recyclingKeyFor)(url),
61
76
  ...viewProps,
62
77
  ref: ref,
63
78
  style: style,
79
+ resizeMode: resizeMode,
64
80
  image: loader
65
81
  });
66
82
  });
@@ -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;AAMA,IAAAG,uBAAA,GAAAH,OAAA;AAAkE,IAAAI,WAAA,GAAAJ,OAAA;AAKlE;AACA;AACA;AACA;AACA;;AA+BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMK,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,EAACnB,sBAAA,CAAAoB;EACC;EAAA;IACAC,YAAY,EAAEd,GAAI;IAAA,GACdM,SAAS;IACbC,GAAG,EAAEA,GAAI;IACTF,KAAK,EAAEA,KAAM;IACbU,KAAK,EAAEL;EAAO,CACf,CAAC;AAEN,CAAC,CAAC;;AAEF;AACA;AACAb,mBAAmB,CAACmB,WAAW,GAAG,qBAAqB","ignoreList":[]}
1
+ {"version":3,"names":["_react","require","_reactNativeNitroImage","_resizeForStyle","_resolveImageSource","_usePipelineImageLoader","_jsxRuntime","NativePipelineImage","exports","forwardRef","url","blur","cornerRadius","cache","resize","fit","allowUpscale","onLoad","onError","style","resizeMode","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;AAOA,IAAAI,uBAAA,GAAAJ,OAAA;AAAkE,IAAAK,WAAA,GAAAL,OAAA;AAKlE;AACA;AACA;AACA;AACA;;AA2EA;AACA;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;EACEG,GAAG;EACHC,IAAI;EACJC,YAAY;EACZC,KAAK;EACLC,MAAM;EACNC,GAAG;EACHC,YAAY;EACZC,MAAM;EACNC,OAAO;EACPC,KAAK;EACLC,UAAU;EACV,GAAGC;AACL,CAAC,EACDC,GAAG,EACH;EACA;EACA,MAAMC,qBAAqB,GAAGX,YAAY,IAAI,IAAAY,oCAAoB,EAACL,KAAK,CAAC;EACzE;EACA;EACA,MAAMM,MAAM,GAAG,IAAAC,8CAAsB,EAAChB,GAAG,EAAE;IACzCC,IAAI;IACJC,YAAY,EAAEW,qBAAqB;IACnCV,KAAK;IACLC,MAAM;IACN;IACA;IACAC,GAAG,EAAEA,GAAG,IAAIK,UAAU;IACtBJ,YAAY;IACZC,MAAM;IACNC;EACF,CAAC,CAAC;EAEF,oBACE,IAAAZ,WAAA,CAAAqB,GAAA,EAACzB,sBAAA,CAAA0B;EACC;EAAA;IACAC,YAAY,EAAE,IAAAC,mCAAe,EAACpB,GAAG,CAAE;IAAA,GAC/BW,SAAS;IACbC,GAAG,EAAEA,GAAI;IACTH,KAAK,EAAEA,KAAM;IACbC,UAAU,EAAEA,UAAW;IACvBW,KAAK,EAAEN;EAAO,CACf,CAAC;AAEN,CAAC,CAAC;;AAEF;AACA;AACAlB,mBAAmB,CAACyB,WAAW,GAAG,qBAAqB","ignoreList":[]}
@@ -61,10 +61,13 @@ const PipelineImage = exports.PipelineImage = /*#__PURE__*/(0, _react.forwardRef
61
61
  blur = 0,
62
62
  cornerRadius,
63
63
  cache,
64
+ fit,
65
+ allowUpscale,
64
66
  onLoad,
65
67
  onError,
66
68
  style,
67
69
  onLayout,
70
+ resizeMode,
68
71
  ...viewProps
69
72
  }, ref) {
70
73
  const scale = _reactNative.PixelRatio.get();
@@ -72,7 +75,15 @@ const PipelineImage = exports.PipelineImage = /*#__PURE__*/(0, _react.forwardRef
72
75
  const [layoutSize, setLayoutSize] = (0, _react.useState)(undefined);
73
76
  // A numeric style is what the caller declared, so it wins and starts the
74
77
  // request a frame earlier; the measured layout is the fallback.
75
- const resize = styleSize ?? layoutSize;
78
+ const size = styleSize ?? layoutSize;
79
+ // The view's resizeMode and the bitmap's fit are the same four values;
80
+ // an explicit `fit` decouples them.
81
+ const effectiveFit = fit ?? resizeMode;
82
+ const resize = size ? {
83
+ ...size,
84
+ fit: effectiveFit,
85
+ allowUpscale
86
+ } : undefined;
76
87
  // Same precedence: an explicit prop wins over what style implies.
77
88
  const effectiveCornerRadius = cornerRadius ?? (0, _resizeForStyle.cornerRadiusForStyle)(style) ?? 0;
78
89
  const {
@@ -115,6 +126,7 @@ const PipelineImage = exports.PipelineImage = /*#__PURE__*/(0, _react.forwardRef
115
126
  ...viewProps,
116
127
  ref: ref,
117
128
  style: style,
129
+ resizeMode: resizeMode,
118
130
  onLayout: handleLayout,
119
131
  image: image
120
132
  });
@@ -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;AAUA,IAAAI,SAAA,GAAAJ,OAAA;AAAsC,IAAAK,WAAA,GAAAL,OAAA;AAKtC;AACA;AACA;AACA;AACA;;AAgCA,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;IA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AACrB,OAAO,CAAC;EAClC,IAAAuB,gBAAS,EAAC,MAAM;IACdH,SAAS,CAACI,OAAO,GAAGzB,MAAM;IAC1BuB,UAAU,CAACE,OAAO,GAAGxB,OAAO;EAC9B,CAAC,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":[]}
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","fit","allowUpscale","onLoad","onError","style","onLayout","resizeMode","viewProps","ref","PixelRatio","get","styleSize","resizeForStyle","layoutSize","setLayoutSize","useState","undefined","size","effectiveFit","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;AAYA,IAAAI,SAAA,GAAAJ,OAAA;AAAsC,IAAAK,WAAA,GAAAL,OAAA;AAKtC;AACA;AACA;AACA;AACA;;AA+DA,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;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A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A0B,gBAAS,EAAC,MAAM;IACdH,SAAS,CAACI,OAAO,GAAG5B,MAAM;IAC1B0B,UAAU,CAACE,OAAO,GAAG3B,OAAO;EAC9B,CAAC,CAAC;EACF,IAAA0B,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;IACjD3B,QAAQ,GAAG2B,KAAK,CAAC;IACjB,MAAM;MAAE/C,KAAK;MAAEC;IAAO,CAAC,GAAG8C,KAAK,CAACC,WAAW,CAACC,MAAM;IAClD,MAAMC,IAAI,GAAG,IAAAC,+BAAe,EAACnD,KAAK,EAAEC,MAAM,CAAC;IAC3C;IACA;IACA4B,aAAa,CAAEuB,IAAI,IAAMvD,QAAQ,CAACuD,IAAI,EAAEF,IAAI,CAAC,GAAGE,IAAI,GAAGF,IAAK,CAAC;EAC/D,CAAC;EAED,oBACE,IAAAtD,WAAA,CAAAyD,GAAA,EAAC5D,sBAAA,CAAA6D,gBAAgB;IAAA,GACXhC,SAAS;IACbC,GAAG,EAAEA,GAAI;IACTJ,KAAK,EAAEA,KAAM;IACbE,UAAU,EAAEA,UAAW;IACvBD,QAAQ,EAAE0B,YAAa;IACvBT,KAAK,EAAEA;EAAM,CACd,CAAC;AAEN,CACF,CAAC;;AAED;AACA;AACA5B,aAAa,CAAC8C,WAAW,GAAG,eAAe","ignoreList":[]}
@@ -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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,oBAAA,GAAAC,OAAA;AAKA,IAAAC,mBAAA,GAAAD,OAAA;AACA,IAAAE,cAAA,GAAAF,OAAA;AAKA,IAAAG,eAAA,GAAAH,OAAA;AAYA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,uBAAA,GAAAL,OAAA","ignoreList":[]}
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;AAaA,IAAAK,SAAA,GAAAL,OAAA;AACA,IAAAM,uBAAA,GAAAN,OAAA","ignoreList":[]}
@@ -10,7 +10,9 @@ var _reactNative = require("react-native");
10
10
  /**
11
11
  * Converts a layout size in points (dp) to the pipeline's `resize` option in
12
12
  * whole bitmap pixels using `PixelRatio.getPixelSizeForLayoutSize`. Returns
13
- * `undefined` unless both values are positive numbers.
13
+ * `undefined` unless both values are positive numbers. Spread a `fit` into
14
+ * the result for the other resize modes — under `contain` and `center` the
15
+ * size is the box the bitmap fits in, not necessarily its final size.
14
16
  */
15
17
  function resizeForLayout(width, height) {
16
18
  if (typeof width !== 'number' || typeof height !== 'number') {
@@ -1 +1 @@
1
- {"version":3,"names":["_reactNative","require","resizeForLayout","width","height","undefined","pixelWidth","PixelRatio","getPixelSizeForLayoutSize","pixelHeight","resizeForStyle","style","flat","StyleSheet","flatten","cornerRadiusForStyle","base","borderRadius","topLeft","borderTopLeftRadius","topRight","borderTopRightRadius","bottomLeft","borderBottomLeftRadius","bottomRight","borderBottomRightRadius"],"sourceRoot":"../../src","sources":["resizeForStyle.ts"],"mappings":";;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAYA;AACA;AACA;AACA;AACA;AACO,SAASC,eAAeA,CAC7BC,KAAc,EACdC,MAAe,EACY;EAC3B,IAAI,OAAOD,KAAK,KAAK,QAAQ,IAAI,OAAOC,MAAM,KAAK,QAAQ,EAAE;IAC3D,OAAOC,SAAS;EAClB;EACA,MAAMC,UAAU,GAAGC,uBAAU,CAACC,yBAAyB,CAACL,KAAK,CAAC;EAC9D,MAAMM,WAAW,GAAGF,uBAAU,CAACC,yBAAyB,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b;EAEA,OAAO;IACLE,OAAO,EAAEA,OAAO,IAAIF,IAAI;IACxBI,QAAQ,EAAEA,QAAQ,IAAIJ,IAAI;IAC1BM,UAAU,EAAEA,UAAU,IAAIN,IAAI;IAC9BQ,WAAW,EAAEA,WAAW,IAAIR;EAC9B,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"names":["_reactNative","require","resizeForLayout","width","height","undefined","pixelWidth","PixelRatio","getPixelSizeForLayoutSize","pixelHeight","resizeForStyle","style","flat","StyleSheet","flatten","cornerRadiusForStyle","base","borderRadius","topLeft","borderTopLeftRadius","topRight","borderTopRightRadius","bottomLeft","borderBottomLeftRadius","bottomRight","borderBottomRightRadius"],"sourceRoot":"../../src","sources":["resizeForStyle.ts"],"mappings":";;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAYA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,eAAeA,CAC7BC,KAAc,EACdC,MAAe,EACY;EAC3B,IAAI,OAAOD,KAAK,KAAK,QAAQ,IAAI,OAAOC,MAAM,KAAK,QAAQ,EAAE;IAC3D,OAAOC,SAAS;EAClB;EACA,MAAMC,UAAU,GAAGC,uBAAU,CAACC,yBAAyB,CAACL,KAAK,CAAC;EAC9D,MAAMM,WAAW,GAAGF,uBAAU,CAACC,yBAAyB,CAACJ,MAAM,CAAC;EAChE,OAAOE,UAAU,GAAG,CAAC,IAAIG,WAAW,GAAG,CAAC,GACpC;IAAEN,KAAK,EAAEG,UAAU;IAAEF,MAAM,EAAEK;EAAY,CAAC,GAC1CJ,SAAS;AACf;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASK,cAAcA,CAC5BC,KAA2B,EACA;EAC3B,MAAMC,IAAI,GAAGC,uBAAU,CAACC,OAAO,CAACH,KAAK,CAAC;EACtC,OAAOT,eAAe,CAACU,IAAI,EAAET,KAAK,EAAES,IAAI,EAAER,MAAM,CAAC;AACnD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASW,oBAAoBA,CAClCJ,KAA2B,EACO;EAClC,MAAMC,IAAI,GAAGC,uBAAU,CAACC,OAAO,CAACH,KAAK,CAAC;EACtC,MAAMK,IAAI,GACR,OAAOJ,IAAI,EAAEK,YAAY,KAAK,QAAQ,GAAGL,IAAI,CAACK,YAAY,GAAGZ,SAAS;EACxE,MAAMa,OAAO,GACX,OAAON,IAAI,EAAEO,mBAAmB,KAAK,QAAQ,GACzCP,IAAI,CAACO,mBAAmB,GACxBd,SAAS;EACf,MAAMe,QAAQ,GACZ,OAAOR,IAAI,EAAES,oBAAoB,KAAK,QAAQ,GAC1CT,IAAI,CAACS,oBAAoB,GACzBhB,SAAS;EACf,MAAMiB,UAAU,GACd,OAAOV,IAAI,EAAEW,sBAAsB,KAAK,QAAQ,GAC5CX,IAAI,CAACW,sBAAsB,GAC3BlB,SAAS;EACf,MAAMmB,WAAW,GACf,OAAOZ,IAAI,EAAEa,uBAAuB,KAAK,QAAQ,GAC7Cb,IAAI,CAACa,uBAAuB,GAC5BpB,SAAS;EAEf,IACEa,OAAO,KAAKb,SAAS,IACrBe,QAAQ,KAAKf,SAAS,IACtBiB,UAAU,KAAKjB,SAAS,IACxBmB,WAAW,KAAKnB,SAAS,EACzB;IACA,OAAOW,IAAI;EACb;EAEA,OAAO;IACLE,OAAO,EAAEA,OAAO,IAAIF,IAAI;IACxBI,QAAQ,EAAEA,QAAQ,IAAIJ,IAAI;IAC1BM,UAAU,EAAEA,UAAU,IAAIN,IAAI;IAC9BQ,WAAW,EAAEA,WAAW,IAAIR;EAC9B,CAAC;AACH","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":[]}
@@ -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
- * given {@linkcode AsyncImageSource} into memory.
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({ filePath: '/tmp/image.jpg' })
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({
@@ -40,6 +42,8 @@ function useImage({
40
42
  } = isUniformRadius ? {} : cornerRadius;
41
43
  const resizeWidth = resize?.width ?? 0;
42
44
  const resizeHeight = resize?.height ?? 0;
45
+ const resizeFit = resize?.fit;
46
+ const resizeAllowUpscale = resize?.allowUpscale;
43
47
  (0, _react.useEffect)(() => {
44
48
  let cancelled = false;
45
49
  // Only reset to the loading state when the URL changes; for same-URL
@@ -55,7 +59,9 @@ function useImage({
55
59
  if (enabled) {
56
60
  (async () => {
57
61
  try {
58
- const result = await _NitroImagePipeline.NitroImagePipeline.loadImage(url, {
62
+ // Resolved inside the try so an unregistered `require()` id
63
+ // surfaces as the error state instead of throwing from the effect.
64
+ const result = await _NitroImagePipeline.NitroImagePipeline.loadImage((0, _resolveImageSource.resolveImageUrl)(url), {
59
65
  blur,
60
66
  cornerRadius: isUniformRadius ? uniformRadius : {
61
67
  topLeft,
@@ -65,7 +71,9 @@ function useImage({
65
71
  },
66
72
  resize: resizeWidth > 0 && resizeHeight > 0 ? {
67
73
  width: resizeWidth,
68
- height: resizeHeight
74
+ height: resizeHeight,
75
+ fit: resizeFit,
76
+ allowUpscale: resizeAllowUpscale
69
77
  } : undefined,
70
78
  cache
71
79
  });
@@ -89,7 +97,7 @@ function useImage({
89
97
  return () => {
90
98
  cancelled = true;
91
99
  };
92
- }, [url, blur, isUniformRadius, uniformRadius, topLeft, topRight, bottomLeft, bottomRight, resizeWidth, resizeHeight, cache, enabled]);
100
+ }, [url, blur, isUniformRadius, uniformRadius, topLeft, topRight, bottomLeft, bottomRight, resizeWidth, resizeHeight, resizeFit, resizeAllowUpscale, cache, enabled]);
93
101
  return image;
94
102
  }
95
103
  //# sourceMappingURL=useImage.js.map
@@ -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,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CAAC;YAClDf,MAAM,EACJgB,WAAW,GAAG,CAAC,IAAIE,YAAY,GAAG,CAAC,GAC/B;cAAED,KAAK,EAAED,WAAW;cAAEG,MAAM,EAAED;YAAa,CAAC,GAC5CZ,SAAS;YACfL;UACF,CAAC,CAAC;UAEF,IAAI,CAACoB,SAAS,EAAE;YACdjB,QAAQ,CAAC;cAAED,KAAK,EAAEoB,MAAM;cAAEhB,KAAK,EAAED;YAAU,CAAC,CAAC;UAC/C;QACF,CAAC,CAAC,OAAOoB,CAAC,EAAE;UACV,MAAMnB,KAAK,GAAGmB,CAAC,YAAYC,KAAK,GAAGD,CAAC,GAAG,IAAIC,KAAK,CAAC,GAAGD,CAAC,EAAE,CAAC;UACxD,IAAI,CAACL,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":[]}
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","resizeFit","fit","resizeAllowUpscale","allowUpscale","useEffect","cancelled","current","result","NitroImagePipeline","loadImage","resolveImageUrl","e","Error"],"sourceRoot":"../../src","sources":["useImage.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAGA,IAAAC,mBAAA,GAAAD,OA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