expo-image 2.0.5 → 2.0.7

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/CHANGELOG.md CHANGED
@@ -10,6 +10,18 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
+ ## 2.0.7 — 2025-03-26
14
+
15
+ ### 🐛 Bug fixes
16
+
17
+ - [iOS] Fixed image be cropped with `contentPosition` on New Architecture mode. ([#35630](https://github.com/expo/expo/pull/35630) by [@kudo](https://github.com/kudo))
18
+
19
+ ## 2.0.6 — 2025-02-19
20
+
21
+ ### 🐛 Bug fixes
22
+
23
+ - [Android] Fixes a regression in `loadAsync` from [#34767](https://github.com/expo/expo/pull/34767). ([#34965](https://github.com/expo/expo/pull/34965) by [@alanjhughes](https://github.com/alanjhughes))
24
+
13
25
  ## 2.0.5 — 2025-02-10
14
26
 
15
27
  ### 🐛 Bug fixes
@@ -18,7 +18,7 @@ android {
18
18
  namespace "expo.modules.image"
19
19
  defaultConfig {
20
20
  versionCode 1
21
- versionName "2.0.5"
21
+ versionName "2.0.7"
22
22
  consumerProguardFiles("proguard-rules.pro")
23
23
 
24
24
  buildConfigField("boolean", "ALLOW_GLIDE_LOGS", project.properties.get("EXPO_ALLOW_GLIDE_LOGS", "false"))
@@ -1,18 +1,12 @@
1
1
  package expo.modules.image
2
2
 
3
3
  import com.bumptech.glide.Glide
4
- import com.bumptech.glide.load.model.GlideUrl
5
- import com.bumptech.glide.load.model.Headers
6
- import com.bumptech.glide.load.model.LazyHeaders
7
4
  import expo.modules.image.records.ImageLoadOptions
8
5
  import expo.modules.image.records.SourceMap
9
6
  import expo.modules.kotlin.AppContext
10
7
  import expo.modules.kotlin.exception.Exceptions
11
8
  import kotlinx.coroutines.Dispatchers
12
9
  import kotlinx.coroutines.withContext
13
- import kotlin.apply
14
- import kotlin.collections.component1
15
- import kotlin.collections.component2
16
10
 
17
11
  open class ImageLoadTask(
18
12
  private val appContext: AppContext,
@@ -23,20 +17,15 @@ open class ImageLoadTask(
23
17
  val context =
24
18
  this@ImageLoadTask.appContext.reactContext ?: throw Exceptions.ReactContextLost()
25
19
 
26
- val headers = source.headers?.let {
27
- LazyHeaders.Builder().apply {
28
- it.forEach { (key, value) ->
29
- addHeader(key, value)
30
- }
31
- }.build()
32
- } ?: Headers.DEFAULT
20
+ val sourceToLoad = source.createGlideModelProvider(context)
21
+ val model = sourceToLoad?.getGlideModel()
33
22
 
34
23
  try {
35
24
  val bitmap = withContext(Dispatchers.IO) {
36
25
  Glide
37
26
  .with(context)
38
27
  .asDrawable()
39
- .load(GlideUrl(source.uri, headers))
28
+ .load(model)
40
29
  .centerInside()
41
30
  .submit(options.maxWidth, options.maxHeight)
42
31
  .get()
@@ -362,7 +362,20 @@ public final class ImageView: ExpoView {
362
362
  */
363
363
  private func applyContentPosition(contentSize: CGSize, containerSize: CGSize) {
364
364
  let offset = contentPosition.offset(contentSize: contentSize, containerSize: containerSize)
365
- sdImageView.layer.frame.origin = offset
365
+ if sdImageView.layer.mask != nil {
366
+ // In New Architecture mode, React Native adds a mask layer to image subviews.
367
+ // When moving the layer frame, we must move the mask layer with a compensation value.
368
+ // This prevents the layer from being cropped.
369
+ // See https://github.com/expo/expo/issues/34201
370
+ // and https://github.com/facebook/react-native/blob/c72d4c5ee97/packages/react-native/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm#L1066-L1076
371
+ CATransaction.begin()
372
+ CATransaction.setDisableActions(true)
373
+ sdImageView.layer.frame.origin = offset
374
+ sdImageView.layer.mask?.frame.origin = CGPoint(x: -offset.x, y: -offset.y)
375
+ CATransaction.commit()
376
+ } else {
377
+ sdImageView.layer.frame.origin = offset
378
+ }
366
379
  }
367
380
 
368
381
  internal func renderSourceImage(_ image: UIImage?) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "expo-image",
3
3
  "title": "Expo Image",
4
- "version": "2.0.5",
4
+ "version": "2.0.7",
5
5
  "description": "A cross-platform, performant image component for React Native and Expo with Web support",
6
6
  "main": "src/index.ts",
7
7
  "types": "build/index.d.ts",
@@ -28,7 +28,7 @@
28
28
  "license": "MIT",
29
29
  "dependencies": {},
30
30
  "devDependencies": {
31
- "expo-module-scripts": "^4.0.3"
31
+ "expo-module-scripts": "^4.0.4"
32
32
  },
33
33
  "peerDependencies": {
34
34
  "expo": "*",
@@ -41,5 +41,5 @@
41
41
  "optional": true
42
42
  }
43
43
  },
44
- "gitHead": "81941fa03383e748ba1b6345d9ca0d048bb5c4d1"
44
+ "gitHead": "5f0263343cdcddf406eb01fe2fb68182be041fd9"
45
45
  }