expo-image 2.3.3-canary-20250701-6a945c5 → 2.4.0-canary-20250713-8f814f8
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 +11 -1
- package/android/build.gradle +1 -1
- package/android/src/main/java/expo/modules/image/ExpoImageModule.kt +20 -0
- package/android/src/main/java/expo/modules/image/blurhash/BlurhashDecoder.kt +1 -10
- package/android/src/main/java/expo/modules/image/blurhash/BlurhashEncoder.kt +112 -0
- package/android/src/main/java/expo/modules/image/blurhash/BlurhashHelpers.kt +38 -0
- package/build/Image.d.ts +3 -2
- package/build/Image.d.ts.map +1 -1
- package/build/Image.types.d.ts +9 -0
- package/build/Image.types.d.ts.map +1 -1
- package/expo-module.config.json +1 -1
- package/ios/ExpoImage.podspec +1 -1
- package/ios/ImageModule.swift +24 -11
- package/ios/ImageView.swift +8 -1
- package/ios/Loaders/PhotoLibraryAssetLoader.swift +15 -1
- package/local-maven-repo/BareExpo/expo.modules.image/{2.3.3-canary-20250701-6a945c5/expo.modules.image-2.3.3-canary-20250701-6a945c5-sources.jar → 2.4.0-canary-20250713-8f814f8/expo.modules.image-2.4.0-canary-20250713-8f814f8-sources.jar} +0 -0
- package/local-maven-repo/BareExpo/expo.modules.image/2.4.0-canary-20250713-8f814f8/expo.modules.image-2.4.0-canary-20250713-8f814f8-sources.jar.md5 +1 -0
- package/local-maven-repo/BareExpo/expo.modules.image/2.4.0-canary-20250713-8f814f8/expo.modules.image-2.4.0-canary-20250713-8f814f8-sources.jar.sha1 +1 -0
- package/local-maven-repo/BareExpo/expo.modules.image/2.4.0-canary-20250713-8f814f8/expo.modules.image-2.4.0-canary-20250713-8f814f8-sources.jar.sha256 +1 -0
- package/local-maven-repo/BareExpo/expo.modules.image/2.4.0-canary-20250713-8f814f8/expo.modules.image-2.4.0-canary-20250713-8f814f8-sources.jar.sha512 +1 -0
- package/local-maven-repo/BareExpo/expo.modules.image/2.4.0-canary-20250713-8f814f8/expo.modules.image-2.4.0-canary-20250713-8f814f8.aar +0 -0
- package/local-maven-repo/BareExpo/expo.modules.image/2.4.0-canary-20250713-8f814f8/expo.modules.image-2.4.0-canary-20250713-8f814f8.aar.md5 +1 -0
- package/local-maven-repo/BareExpo/expo.modules.image/2.4.0-canary-20250713-8f814f8/expo.modules.image-2.4.0-canary-20250713-8f814f8.aar.sha1 +1 -0
- package/local-maven-repo/BareExpo/expo.modules.image/2.4.0-canary-20250713-8f814f8/expo.modules.image-2.4.0-canary-20250713-8f814f8.aar.sha256 +1 -0
- package/local-maven-repo/BareExpo/expo.modules.image/2.4.0-canary-20250713-8f814f8/expo.modules.image-2.4.0-canary-20250713-8f814f8.aar.sha512 +1 -0
- package/local-maven-repo/BareExpo/expo.modules.image/{2.3.3-canary-20250701-6a945c5/expo.modules.image-2.3.3-canary-20250701-6a945c5.module → 2.4.0-canary-20250713-8f814f8/expo.modules.image-2.4.0-canary-20250713-8f814f8.module} +22 -22
- package/local-maven-repo/BareExpo/expo.modules.image/2.4.0-canary-20250713-8f814f8/expo.modules.image-2.4.0-canary-20250713-8f814f8.module.md5 +1 -0
- package/local-maven-repo/BareExpo/expo.modules.image/2.4.0-canary-20250713-8f814f8/expo.modules.image-2.4.0-canary-20250713-8f814f8.module.sha1 +1 -0
- package/local-maven-repo/BareExpo/expo.modules.image/2.4.0-canary-20250713-8f814f8/expo.modules.image-2.4.0-canary-20250713-8f814f8.module.sha256 +1 -0
- package/local-maven-repo/BareExpo/expo.modules.image/2.4.0-canary-20250713-8f814f8/expo.modules.image-2.4.0-canary-20250713-8f814f8.module.sha512 +1 -0
- package/local-maven-repo/BareExpo/expo.modules.image/{2.3.3-canary-20250701-6a945c5/expo.modules.image-2.3.3-canary-20250701-6a945c5.pom → 2.4.0-canary-20250713-8f814f8/expo.modules.image-2.4.0-canary-20250713-8f814f8.pom} +1 -1
- package/local-maven-repo/BareExpo/expo.modules.image/2.4.0-canary-20250713-8f814f8/expo.modules.image-2.4.0-canary-20250713-8f814f8.pom.md5 +1 -0
- package/local-maven-repo/BareExpo/expo.modules.image/2.4.0-canary-20250713-8f814f8/expo.modules.image-2.4.0-canary-20250713-8f814f8.pom.sha1 +1 -0
- package/local-maven-repo/BareExpo/expo.modules.image/2.4.0-canary-20250713-8f814f8/expo.modules.image-2.4.0-canary-20250713-8f814f8.pom.sha256 +1 -0
- package/local-maven-repo/BareExpo/expo.modules.image/2.4.0-canary-20250713-8f814f8/expo.modules.image-2.4.0-canary-20250713-8f814f8.pom.sha512 +1 -0
- package/local-maven-repo/BareExpo/expo.modules.image/maven-metadata.xml +4 -4
- package/local-maven-repo/BareExpo/expo.modules.image/maven-metadata.xml.md5 +1 -1
- package/local-maven-repo/BareExpo/expo.modules.image/maven-metadata.xml.sha1 +1 -1
- package/local-maven-repo/BareExpo/expo.modules.image/maven-metadata.xml.sha256 +1 -1
- package/local-maven-repo/BareExpo/expo.modules.image/maven-metadata.xml.sha512 +1 -1
- package/package.json +3 -3
- package/src/Image.tsx +4 -3
- package/src/Image.types.ts +10 -0
- package/local-maven-repo/BareExpo/expo.modules.image/2.3.3-canary-20250701-6a945c5/expo.modules.image-2.3.3-canary-20250701-6a945c5-sources.jar.md5 +0 -1
- package/local-maven-repo/BareExpo/expo.modules.image/2.3.3-canary-20250701-6a945c5/expo.modules.image-2.3.3-canary-20250701-6a945c5-sources.jar.sha1 +0 -1
- package/local-maven-repo/BareExpo/expo.modules.image/2.3.3-canary-20250701-6a945c5/expo.modules.image-2.3.3-canary-20250701-6a945c5-sources.jar.sha256 +0 -1
- package/local-maven-repo/BareExpo/expo.modules.image/2.3.3-canary-20250701-6a945c5/expo.modules.image-2.3.3-canary-20250701-6a945c5-sources.jar.sha512 +0 -1
- package/local-maven-repo/BareExpo/expo.modules.image/2.3.3-canary-20250701-6a945c5/expo.modules.image-2.3.3-canary-20250701-6a945c5.aar +0 -0
- package/local-maven-repo/BareExpo/expo.modules.image/2.3.3-canary-20250701-6a945c5/expo.modules.image-2.3.3-canary-20250701-6a945c5.aar.md5 +0 -1
- package/local-maven-repo/BareExpo/expo.modules.image/2.3.3-canary-20250701-6a945c5/expo.modules.image-2.3.3-canary-20250701-6a945c5.aar.sha1 +0 -1
- package/local-maven-repo/BareExpo/expo.modules.image/2.3.3-canary-20250701-6a945c5/expo.modules.image-2.3.3-canary-20250701-6a945c5.aar.sha256 +0 -1
- package/local-maven-repo/BareExpo/expo.modules.image/2.3.3-canary-20250701-6a945c5/expo.modules.image-2.3.3-canary-20250701-6a945c5.aar.sha512 +0 -1
- package/local-maven-repo/BareExpo/expo.modules.image/2.3.3-canary-20250701-6a945c5/expo.modules.image-2.3.3-canary-20250701-6a945c5.module.md5 +0 -1
- package/local-maven-repo/BareExpo/expo.modules.image/2.3.3-canary-20250701-6a945c5/expo.modules.image-2.3.3-canary-20250701-6a945c5.module.sha1 +0 -1
- package/local-maven-repo/BareExpo/expo.modules.image/2.3.3-canary-20250701-6a945c5/expo.modules.image-2.3.3-canary-20250701-6a945c5.module.sha256 +0 -1
- package/local-maven-repo/BareExpo/expo.modules.image/2.3.3-canary-20250701-6a945c5/expo.modules.image-2.3.3-canary-20250701-6a945c5.module.sha512 +0 -1
- package/local-maven-repo/BareExpo/expo.modules.image/2.3.3-canary-20250701-6a945c5/expo.modules.image-2.3.3-canary-20250701-6a945c5.pom.md5 +0 -1
- package/local-maven-repo/BareExpo/expo.modules.image/2.3.3-canary-20250701-6a945c5/expo.modules.image-2.3.3-canary-20250701-6a945c5.pom.sha1 +0 -1
- package/local-maven-repo/BareExpo/expo.modules.image/2.3.3-canary-20250701-6a945c5/expo.modules.image-2.3.3-canary-20250701-6a945c5.pom.sha256 +0 -1
- package/local-maven-repo/BareExpo/expo.modules.image/2.3.3-canary-20250701-6a945c5/expo.modules.image-2.3.3-canary-20250701-6a945c5.pom.sha512 +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,16 +6,26 @@
|
|
|
6
6
|
|
|
7
7
|
### 🎉 New features
|
|
8
8
|
|
|
9
|
+
- Add support for `ImageRef` source in `generateBlurhashAsync` ([#37901](https://github.com/expo/expo/pull/37901) by [@Wenszel](https://github.com/Wenszel))
|
|
10
|
+
- [Android] Add generateBlurhashAsync ([#37817](https://github.com/expo/expo/pull/37817) by [@Wenszel](https://github.com/Wenszel))
|
|
11
|
+
- [iOS] Add a new prop - `enforceEarlyResizing` to reduce the memory usage of the image view. ([#37909](https://github.com/expo/expo/pull/37909) by [@lukmccall](https://github.com/lukmccall))
|
|
12
|
+
|
|
9
13
|
### 🐛 Bug fixes
|
|
10
14
|
|
|
15
|
+
- [iOS] Speed up displaying local assets. ([#37795](https://github.com/expo/expo/pull/37795) by [@aleqsio](https://github.com/aleqsio))
|
|
11
16
|
- [Android] Fix animation resuming by casting image to GifDrawable. ([#37363](https://github.com/expo/expo/pull/37363) by [@Wenszel](https://github.com/Wenszel))
|
|
12
17
|
- [Web] Fix `alt` as an alias for `accessibilityLabel` ([#37682](https://github.com/expo/expo/pull/37682) by [@huextrat](https://github.com/huextrat))
|
|
13
|
-
- [iOS] Use specified cache type when no transformation is applied ([#37777](https://github.com/expo/expo/pull/37777) by [@jakex7](https://github.com/jakex7))
|
|
14
18
|
|
|
15
19
|
### 💡 Others
|
|
16
20
|
|
|
17
21
|
### 📚 3rd party library updates
|
|
18
22
|
|
|
23
|
+
## 2.3.2 - 2025-07-01
|
|
24
|
+
|
|
25
|
+
### 🐛 Bug fixes
|
|
26
|
+
|
|
27
|
+
- [iOS] Use specified cache type when no transformation is applied ([#37777](https://github.com/expo/expo/pull/37777) by [@jakex7](https://github.com/jakex7))
|
|
28
|
+
|
|
19
29
|
## 2.3.1 - 2025-07-01
|
|
20
30
|
|
|
21
31
|
### 🐛 Bug fixes
|
package/android/build.gradle
CHANGED
|
@@ -8,7 +8,7 @@ android {
|
|
|
8
8
|
namespace "expo.modules.image"
|
|
9
9
|
defaultConfig {
|
|
10
10
|
versionCode 1
|
|
11
|
-
versionName "2.
|
|
11
|
+
versionName "2.4.0-canary-20250713-8f814f8"
|
|
12
12
|
consumerProguardFiles("proguard-rules.pro")
|
|
13
13
|
|
|
14
14
|
buildConfigField("boolean", "ALLOW_GLIDE_LOGS", project.properties.get("EXPO_ALLOW_GLIDE_LOGS", "false"))
|
|
@@ -5,6 +5,7 @@ package expo.modules.image
|
|
|
5
5
|
import android.graphics.Bitmap
|
|
6
6
|
import android.graphics.drawable.BitmapDrawable
|
|
7
7
|
import android.graphics.drawable.Drawable
|
|
8
|
+
import androidx.core.graphics.drawable.toBitmap
|
|
8
9
|
import androidx.core.graphics.drawable.toBitmapOrNull
|
|
9
10
|
import androidx.core.view.doOnDetach
|
|
10
11
|
import com.bumptech.glide.Glide
|
|
@@ -19,6 +20,7 @@ import com.bumptech.glide.request.target.Target
|
|
|
19
20
|
import com.github.penfeizhou.animation.apng.APNGDrawable
|
|
20
21
|
import com.github.penfeizhou.animation.gif.GifDrawable
|
|
21
22
|
import com.github.penfeizhou.animation.webp.WebPDrawable
|
|
23
|
+
import expo.modules.image.blurhash.BlurhashEncoder
|
|
22
24
|
import expo.modules.image.enums.ContentFit
|
|
23
25
|
import expo.modules.image.enums.Priority
|
|
24
26
|
import expo.modules.image.records.CachePolicy
|
|
@@ -36,8 +38,12 @@ import expo.modules.kotlin.functions.Queues
|
|
|
36
38
|
import expo.modules.kotlin.modules.Module
|
|
37
39
|
import expo.modules.kotlin.modules.ModuleDefinition
|
|
38
40
|
import expo.modules.kotlin.sharedobjects.SharedRef
|
|
41
|
+
import expo.modules.kotlin.types.Either
|
|
39
42
|
import expo.modules.kotlin.types.EitherOfThree
|
|
40
43
|
import expo.modules.kotlin.types.toKClass
|
|
44
|
+
import kotlinx.coroutines.Dispatchers
|
|
45
|
+
import kotlinx.coroutines.withContext
|
|
46
|
+
import java.net.URL
|
|
41
47
|
|
|
42
48
|
class ExpoImageModule : Module() {
|
|
43
49
|
override fun definition() = ModuleDefinition {
|
|
@@ -112,6 +118,20 @@ class ExpoImageModule : Module() {
|
|
|
112
118
|
ImageLoadTask(appContext, source, options ?: ImageLoadOptions()).load()
|
|
113
119
|
}
|
|
114
120
|
|
|
121
|
+
AsyncFunction("generateBlurhashAsync") Coroutine { source: Either<URL, Image>, numberOfComponents: Pair<Int, Int> ->
|
|
122
|
+
val image = source.let {
|
|
123
|
+
if (it.`is`(Image::class)) {
|
|
124
|
+
it.get(Image::class)
|
|
125
|
+
} else {
|
|
126
|
+
ImageLoadTask(appContext, SourceMap(uri = it.get(URL::class).toString()), ImageLoadOptions()).load()
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
val blurHash = withContext(Dispatchers.Default) {
|
|
130
|
+
BlurhashEncoder.encode(image.ref.toBitmap(), numberOfComponents)
|
|
131
|
+
}
|
|
132
|
+
blurHash
|
|
133
|
+
}
|
|
134
|
+
|
|
115
135
|
Class(Image::class) {
|
|
116
136
|
Property("width") { image: Image ->
|
|
117
137
|
image.ref.intrinsicWidth
|
|
@@ -74,16 +74,7 @@ object BlurhashDecoder {
|
|
|
74
74
|
val r = colorEnc shr 16
|
|
75
75
|
val g = (colorEnc shr 8) and 255
|
|
76
76
|
val b = colorEnc and 255
|
|
77
|
-
return floatArrayOf(srgbToLinear(r), srgbToLinear(g), srgbToLinear(b))
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
private fun srgbToLinear(colorEnc: Int): Float {
|
|
81
|
-
val v = colorEnc / 255f
|
|
82
|
-
return if (v <= 0.04045f) {
|
|
83
|
-
(v / 12.92f)
|
|
84
|
-
} else {
|
|
85
|
-
((v + 0.055f) / 1.055f).pow(2.4f)
|
|
86
|
-
}
|
|
77
|
+
return floatArrayOf(BlurhashHelpers.srgbToLinear(r), BlurhashHelpers.srgbToLinear(g), BlurhashHelpers.srgbToLinear(b))
|
|
87
78
|
}
|
|
88
79
|
|
|
89
80
|
private fun decodeAc(value: Int, maxAc: Float): FloatArray {
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
package expo.modules.image.blurhash
|
|
2
|
+
|
|
3
|
+
import android.graphics.Bitmap
|
|
4
|
+
import android.graphics.Color
|
|
5
|
+
import kotlin.math.*
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Rewritten in kotlin from https://github.com/woltapp/blurhash/blob/master/Swift/BlurHashEncode.swift
|
|
9
|
+
*/
|
|
10
|
+
object BlurhashEncoder {
|
|
11
|
+
fun encode(image: Bitmap, numberOfComponents: Pair<Int, Int>): String {
|
|
12
|
+
val pixels = IntArray(image.width * image.height)
|
|
13
|
+
image.getPixels(pixels, 0, image.width, 0, 0, image.width, image.height)
|
|
14
|
+
|
|
15
|
+
val factors = calculateBlurFactors(pixels, image.width, image.height, numberOfComponents)
|
|
16
|
+
|
|
17
|
+
val dc = factors.first()
|
|
18
|
+
val ac = factors.drop(1)
|
|
19
|
+
val hashBuilder = StringBuilder()
|
|
20
|
+
|
|
21
|
+
encodeFlag(numberOfComponents, hashBuilder)
|
|
22
|
+
val maximumValue = encodeMaximumValue(ac, hashBuilder)
|
|
23
|
+
hashBuilder.append(encode83(encodeDC(dc), 4))
|
|
24
|
+
for (factor in ac) {
|
|
25
|
+
hashBuilder.append(encode83(encodeAC(factor, maximumValue), 2))
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return hashBuilder.toString()
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
private fun encodeFlag(numberOfComponents: Pair<Int, Int>, hashBuilder: StringBuilder) {
|
|
32
|
+
val sizeFlag = (numberOfComponents.first - 1) + (numberOfComponents.second - 1) * 9
|
|
33
|
+
hashBuilder.append(encode83(sizeFlag, 1))
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
private fun encodeMaximumValue(ac: List<Triple<Float, Float, Float>>, hash: StringBuilder): Float {
|
|
37
|
+
val maximumValue: Float
|
|
38
|
+
if (ac.isNotEmpty()) {
|
|
39
|
+
val actualMaximumValue = ac.maxOf { t -> max(max(abs(t.first), abs(t.second)), abs(t.third)) }
|
|
40
|
+
val quantisedMaximumValue = max(0f, min(82f, floor(actualMaximumValue * 166f - 0.5f))).toInt()
|
|
41
|
+
maximumValue = (quantisedMaximumValue + 1).toFloat() / 166f
|
|
42
|
+
hash.append(encode83(quantisedMaximumValue, 1))
|
|
43
|
+
} else {
|
|
44
|
+
maximumValue = 1f
|
|
45
|
+
hash.append(encode83(0, 1))
|
|
46
|
+
}
|
|
47
|
+
return maximumValue
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
private fun calculateBlurFactors(pixels: IntArray, width: Int, height: Int, numberOfComponents: Pair<Int, Int>): List<Triple<Float, Float, Float>> {
|
|
51
|
+
val factors = mutableListOf<Triple<Float, Float, Float>>()
|
|
52
|
+
for (y in 0 until numberOfComponents.second) {
|
|
53
|
+
for (x in 0 until numberOfComponents.first) {
|
|
54
|
+
val normalisation = if (x == 0 && y == 0) 1f else 2f
|
|
55
|
+
val factor = multiplyBasisFunction(pixels, width, height, x, y, normalisation)
|
|
56
|
+
factors.add(factor)
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return factors
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
private fun encode83(value: Int, length: Int): String {
|
|
63
|
+
var result = ""
|
|
64
|
+
for (i in 1..length) {
|
|
65
|
+
val digit = (value / 83f.pow((length - i).toFloat())) % 83f
|
|
66
|
+
result += ENCODE_CHARACTERS[digit.toInt()]
|
|
67
|
+
}
|
|
68
|
+
return result
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
private const val ENCODE_CHARACTERS =
|
|
72
|
+
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz#$%*+,-.:;=?@[]^_{|}~"
|
|
73
|
+
|
|
74
|
+
private fun encodeDC(value: Triple<Float, Float, Float>): Int {
|
|
75
|
+
val roundedR = BlurhashHelpers.linearTosRGB(value.first)
|
|
76
|
+
val roundedG = BlurhashHelpers.linearTosRGB(value.second)
|
|
77
|
+
val roundedB = BlurhashHelpers.linearTosRGB(value.third)
|
|
78
|
+
return (roundedR shl 16) + (roundedG shl 8) + roundedB
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
private fun encodeAC(value: Triple<Float, Float, Float>, maximumValue: Float): Int {
|
|
82
|
+
val quantR = max(0f, min(18f, floor(BlurhashHelpers.signPow(value.first / maximumValue, 0.5f) * 9f + 9.5f)))
|
|
83
|
+
val quantG = max(0f, min(18f, floor(BlurhashHelpers.signPow(value.second / maximumValue, 0.5f) * 9f + 9.5f)))
|
|
84
|
+
val quantB = max(0f, min(18f, floor(BlurhashHelpers.signPow(value.third / maximumValue, 0.5f) * 9f + 9.5f)))
|
|
85
|
+
|
|
86
|
+
return (quantR * 19f * 19f + quantG * 19f + quantB).toInt()
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
private fun multiplyBasisFunction(pixels: IntArray, width: Int, height: Int, x: Int, y: Int, normalisation: Float): Triple<Float, Float, Float> {
|
|
90
|
+
var r = 0f
|
|
91
|
+
var g = 0f
|
|
92
|
+
var b = 0f
|
|
93
|
+
|
|
94
|
+
for (j in 0 until height) {
|
|
95
|
+
for (i in 0 until width) {
|
|
96
|
+
val basis = normalisation * cos(PI.toFloat() * x * i / width) * cos(PI.toFloat() * y * j / height)
|
|
97
|
+
|
|
98
|
+
val pixel = pixels[i + j * width]
|
|
99
|
+
val pr = BlurhashHelpers.srgbToLinear(Color.red(pixel))
|
|
100
|
+
val pg = BlurhashHelpers.srgbToLinear(Color.green(pixel))
|
|
101
|
+
val pb = BlurhashHelpers.srgbToLinear(Color.blue(pixel))
|
|
102
|
+
|
|
103
|
+
r += basis * pr
|
|
104
|
+
g += basis * pg
|
|
105
|
+
b += basis * pb
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
val scale = 1f / (width * height)
|
|
110
|
+
return Triple(r * scale, g * scale, b * scale)
|
|
111
|
+
}
|
|
112
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
package expo.modules.image.blurhash
|
|
2
|
+
|
|
3
|
+
import android.graphics.Bitmap
|
|
4
|
+
import kotlin.math.*
|
|
5
|
+
|
|
6
|
+
object BlurhashHelpers {
|
|
7
|
+
fun srgbToLinear(colorEnc: Int): Float {
|
|
8
|
+
val v = colorEnc / 255f
|
|
9
|
+
return if (v <= 0.04045f) {
|
|
10
|
+
(v / 12.92f)
|
|
11
|
+
} else {
|
|
12
|
+
((v + 0.055f) / 1.055f).pow(2.4f)
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
fun linearTosRGB(value: Float): Int {
|
|
17
|
+
val v = max(0f, min(1f, value))
|
|
18
|
+
return if (v <= 0.0031308) {
|
|
19
|
+
(v * 12.92 * 255 + 0.5).toInt()
|
|
20
|
+
} else {
|
|
21
|
+
(1.055 * (v.pow(1f / 2.4f) - 0.055) * 255 + 0.5).toInt()
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
fun signPow(value: Float, exp: Float): Float {
|
|
26
|
+
return abs(value).pow(exp) * sign(value)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
fun getBitsPerPixel(bitmap: Bitmap): Int {
|
|
30
|
+
return when (bitmap.config) {
|
|
31
|
+
Bitmap.Config.ARGB_8888 -> 32
|
|
32
|
+
Bitmap.Config.RGB_565 -> 16
|
|
33
|
+
Bitmap.Config.ALPHA_8 -> 8
|
|
34
|
+
Bitmap.Config.ARGB_4444 -> 16
|
|
35
|
+
else -> 0
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
package/build/Image.d.ts
CHANGED
|
@@ -66,13 +66,14 @@ export declare class Image extends React.PureComponent<ImageProps> {
|
|
|
66
66
|
static getCachePathAsync(cacheKey: string): Promise<string | null>;
|
|
67
67
|
/**
|
|
68
68
|
* Asynchronously generates a [Blurhash](https://blurha.sh) from an image.
|
|
69
|
-
* @param
|
|
69
|
+
* @param source - The image source, either a URL (string) or an ImageRef
|
|
70
70
|
* @param numberOfComponents - The number of components to encode the blurhash with.
|
|
71
71
|
* Must be between 1 and 9. Defaults to `[4, 3]`.
|
|
72
|
+
* @platform android
|
|
72
73
|
* @platform ios
|
|
73
74
|
* @return A promise resolving to the blurhash string.
|
|
74
75
|
*/
|
|
75
|
-
static generateBlurhashAsync(
|
|
76
|
+
static generateBlurhashAsync(source: string | ImageRef, numberOfComponents: [number, number] | {
|
|
76
77
|
width: number;
|
|
77
78
|
height: number;
|
|
78
79
|
}): Promise<string | null>;
|
package/build/Image.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Image.d.ts","sourceRoot":"","sources":["../src/Image.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAc,KAAK,IAAI,EAAE,MAAM,cAAc,CAAC;AAErD,OAAO,SAAS,MAAM,aAAa,CAAC;AACpC,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,UAAU,EACV,QAAQ,EACR,WAAW,EACZ,MAAM,eAAe,CAAC;AAQvB,qBAAa,KAAM,SAAQ,KAAK,CAAC,aAAa,CAAC,UAAU,CAAC;IACxD,aAAa,EAAE,KAAK,CAAC,SAAS,CAAC,SAAS,GAAG,IAAI,CAAC,CAAC;IACjD,gBAAgB,EAAE,KAAK,CAAC,SAAS,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC;gBAEnC,KAAK,EAAE,UAAU;IAO7B,gBAAgB,2BAMd;IAEF;;OAEG;IACH,MAAM,CAAC,KAAK,kBAAqB;IAEjC;;;;;;;;;;OAUG;WACU,QAAQ,CACnB,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,EACvB,WAAW,CAAC,EAAE,oBAAoB,CAAC,aAAa,CAAC,GAChD,OAAO,CAAC,OAAO,CAAC;IACnB;;;;;;;;;;OAUG;WACU,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,OAAO,CA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U,cAAc,IAAI,OAAO,CAAC,OAAO,CAAC;IAI/C;;;;;;;;;OASG;WACU,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAIxE;;;;;;;;OAQG;WACU,qBAAqB,CAChC,MAAM,EAAE,MAAM,GAAG,QAAQ,EACzB,kBAAkB,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GACvE,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAIzB;;;;OAIG;IACG,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;IAIrC;;;;OAIG;IACG,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;IAIpC;;;;OAIG;IACG,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC;IAIxC;;;;OAIG;IACG,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC;IAI1C;;;;OAIG;IACG,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IAIlC;;;;;;OAMG;WACU,SAAS,CACpB,MAAM,EAAE,WAAW,GAAG,MAAM,GAAG,MAAM,EACrC,OAAO,CAAC,EAAE,gBAAgB,GACzB,OAAO,CAAC,QAAQ,CAAC;IAKpB,MAAM;CA6CP"}
|
package/build/Image.types.d.ts
CHANGED
|
@@ -313,6 +313,15 @@ export interface ImageProps extends Omit<ViewProps, 'style' | 'children'> {
|
|
|
313
313
|
* @platform ios
|
|
314
314
|
*/
|
|
315
315
|
useAppleWebpCodec?: boolean;
|
|
316
|
+
/**
|
|
317
|
+
* Force early resizing of the image to match the container size.
|
|
318
|
+
* This option helps to reduce the memory usage of the image view, especially when the image is larger than the container.
|
|
319
|
+
* It may affect the `resizeType` and `contentPosition` properties when the image view is resized dynamically.
|
|
320
|
+
*
|
|
321
|
+
* @default false
|
|
322
|
+
* @platform ios
|
|
323
|
+
*/
|
|
324
|
+
enforceEarlyResizing?: boolean;
|
|
316
325
|
}
|
|
317
326
|
/**
|
|
318
327
|
* It narrows down some props to types expected by the native/web side.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Image.types.d.ts","sourceRoot":"","sources":["../src/Image.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,MAAM,CAAC;AACnE,OAAO,EAAE,UAAU,IAAI,YAAY,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEjG,OAAO,SAAS,MAAM,aAAa,CAAC;AAEpC,MAAM,MAAM,WAAW,GAAG;IACxB;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAEvB;;;;;;;;OAQG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;;;OAMG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,YAAY,CAAC;AAEtC;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,YAAY,CAAC;AAEnF;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,KAAK,CAAC;AAE/C;;;GAGG;AACH,MAAM,WAAW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,MAAM,GAAG,aAAa,GAAG,QAAQ,CAAC;IAEhD;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,OAAO,OAAO,QAAS,SAAQ,SAAS,CAAC,OAAO,CAAC;IACtD;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB;;;;;OAKG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB;;;;OAIG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC;;OAEG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,iBAAkB,SAAQ,YAAY;IAEzD,KAAK,EAAE,OAAO,QAAQ,CAAC;IAEvB,SAAS,CAAC,MAAM,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,QAAQ,CAAC;CAC9E;AAED;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,OAAO,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,IAAI,GAAG,IAAI,CAAC;CACjD,CAAC"}
|
package/expo-module.config.json
CHANGED
package/ios/ExpoImage.podspec
CHANGED
package/ios/ImageModule.swift
CHANGED
|
@@ -111,6 +111,10 @@ public final class ImageModule: Module {
|
|
|
111
111
|
view.useAppleWebpCodec = useAppleWebpCodec
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
+
Prop("enforceEarlyResizing", false) { (view, enforceEarlyResizing: Bool) in
|
|
115
|
+
view.enforceEarlyResizing = enforceEarlyResizing
|
|
116
|
+
}
|
|
117
|
+
|
|
114
118
|
AsyncFunction("startAnimating") { (view: ImageView) in
|
|
115
119
|
view.sdImageView.startAnimating()
|
|
116
120
|
}
|
|
@@ -166,19 +170,28 @@ public final class ImageModule: Module {
|
|
|
166
170
|
}
|
|
167
171
|
}
|
|
168
172
|
|
|
169
|
-
AsyncFunction("generateBlurhashAsync") { (
|
|
173
|
+
AsyncFunction("generateBlurhashAsync") { (source: Either<Image, URL>, numberOfComponents: CGSize, promise: Promise) in
|
|
170
174
|
let downloader = SDWebImageDownloader()
|
|
171
|
-
let parsedNumberOfComponents = (Int(numberOfComponents.width), Int(numberOfComponents.height))
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
promise.reject(BlurhashGenerationException())
|
|
179
|
-
}
|
|
175
|
+
let parsedNumberOfComponents = (width: Int(numberOfComponents.width), height: Int(numberOfComponents.height))
|
|
176
|
+
|
|
177
|
+
if let image: Image = source.get() {
|
|
178
|
+
if let blurhashString = blurhash(fromImage: image.ref, numberOfComponents: parsedNumberOfComponents) {
|
|
179
|
+
promise.resolve(blurhashString)
|
|
180
|
+
} else {
|
|
181
|
+
promise.reject(BlurhashGenerationException())
|
|
180
182
|
}
|
|
181
|
-
})
|
|
183
|
+
} else if let url: URL = source.get() {
|
|
184
|
+
downloader.downloadImage(with: url, progress: nil, completed: { image, _, _, _ in
|
|
185
|
+
DispatchQueue.global().async {
|
|
186
|
+
if let downloadedImage = image {
|
|
187
|
+
let blurhashString = blurhash(fromImage: downloadedImage, numberOfComponents: parsedNumberOfComponents)
|
|
188
|
+
promise.resolve(blurhashString)
|
|
189
|
+
} else {
|
|
190
|
+
promise.reject(BlurhashGenerationException())
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
})
|
|
194
|
+
}
|
|
182
195
|
}
|
|
183
196
|
|
|
184
197
|
AsyncFunction("clearMemoryCache") { () -> Bool in
|
package/ios/ImageView.swift
CHANGED
|
@@ -12,6 +12,8 @@ typealias SDWebImageContext = [SDWebImageContextOption: Any]
|
|
|
12
12
|
public final class ImageView: ExpoView {
|
|
13
13
|
static let contextSourceKey = SDWebImageContextOption(rawValue: "source")
|
|
14
14
|
static let screenScaleKey = SDWebImageContextOption(rawValue: "screenScale")
|
|
15
|
+
static let contentFitKey = SDWebImageContextOption(rawValue: "contentFit")
|
|
16
|
+
static let frameSizeKey = SDWebImageContextOption(rawValue: "frameSize")
|
|
15
17
|
|
|
16
18
|
let sdImageView = SDAnimatedImageView(frame: .zero)
|
|
17
19
|
|
|
@@ -58,6 +60,8 @@ public final class ImageView: ExpoView {
|
|
|
58
60
|
|
|
59
61
|
var lockResource: Bool = false
|
|
60
62
|
|
|
63
|
+
var enforceEarlyResizing: Bool = false
|
|
64
|
+
|
|
61
65
|
var recyclingKey: String? {
|
|
62
66
|
didSet {
|
|
63
67
|
if oldValue != nil && recyclingKey != oldValue {
|
|
@@ -161,7 +165,8 @@ public final class ImageView: ExpoView {
|
|
|
161
165
|
|
|
162
166
|
// It seems that `UIImageView` can't tint some vector graphics. If the `tintColor` prop is specified,
|
|
163
167
|
// we tell the SVG coder to decode to a bitmap instead. This will become useless when we switch to SVGNative coder.
|
|
164
|
-
|
|
168
|
+
let shouldEarlyResize = imageTintColor != nil || enforceEarlyResizing
|
|
169
|
+
if shouldEarlyResize {
|
|
165
170
|
context[.imagePreserveAspectRatio] = true
|
|
166
171
|
context[.imageThumbnailPixelSize] = CGSize(
|
|
167
172
|
width: sdImageView.bounds.size.width * screenScale,
|
|
@@ -171,6 +176,8 @@ public final class ImageView: ExpoView {
|
|
|
171
176
|
|
|
172
177
|
// Some loaders (e.g. PhotoLibraryAssetLoader) may need to know the screen scale.
|
|
173
178
|
context[ImageView.screenScaleKey] = screenScale
|
|
179
|
+
context[ImageView.frameSizeKey] = frame.size
|
|
180
|
+
context[ImageView.contentFitKey] = contentFit
|
|
174
181
|
|
|
175
182
|
// Do it here so we don't waste resources trying to fetch from a remote URL
|
|
176
183
|
if maybeRenderLocalAsset(from: source) {
|
|
@@ -107,9 +107,23 @@ private func requestAsset(
|
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
+
var targetSize = PHImageManagerMaximumSize
|
|
111
|
+
|
|
112
|
+
// We compute the minimal size required to display the image to avoid having to downsample it later
|
|
113
|
+
if let scale = context?[ImageView.screenScaleKey] as? Double,
|
|
114
|
+
let containerSize = context?[ImageView.frameSizeKey] as? CGSize,
|
|
115
|
+
let contentFit = context?[ImageView.contentFitKey] as? ContentFit {
|
|
116
|
+
let targetSize = idealSize(
|
|
117
|
+
contentPixelSize: CGSize(width: asset.pixelWidth, height: asset.pixelHeight),
|
|
118
|
+
containerSize: containerSize,
|
|
119
|
+
scale: scale,
|
|
120
|
+
contentFit: contentFit
|
|
121
|
+
).rounded(.up) * scale
|
|
122
|
+
}
|
|
123
|
+
|
|
110
124
|
return PHImageManager.default().requestImage(
|
|
111
125
|
for: asset,
|
|
112
|
-
targetSize:
|
|
126
|
+
targetSize: targetSize,
|
|
113
127
|
contentMode: .aspectFit,
|
|
114
128
|
options: options,
|
|
115
129
|
resultHandler: { image, info in
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
fb1a021a3c959caf9c844732221afe77
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
f59c1a61e799d72cf2da93e51bdb6bfc76a1fecb
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
047cf4256d9f1f9d37b874fe403d46abd838a59bbdf3d5b923d25b546242d99f
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
5088775ebe8dbdd3636ae44627d45f466d3b26af289ccd64cc7f59a1db50045ec4c246dfacdfa80fdedd21b09f837215dd2f0843c8915c10afe74400ec3e626c
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
987b16fc46ba4dfb8d53af2daf99fc7a
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
d892986ab6d024ecfd622bf341abc5e0852b67e6
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
28459572fbb29787a5b5eaab8cbec8d65ebcb8b1bff80d4b41020b76188714dc
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
5928b97432f974641d14f99976ddd03c1933731a6dc215222f3635e8fd3a93fc807eb2068ac61b5618ade31e881c73cba403dec7737c0ad5ea15b23e146c9b87
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"component": {
|
|
4
4
|
"group": "BareExpo",
|
|
5
5
|
"module": "expo.modules.image",
|
|
6
|
-
"version": "2.
|
|
6
|
+
"version": "2.4.0-canary-20250713-8f814f8",
|
|
7
7
|
"attributes": {
|
|
8
8
|
"org.gradle.status": "release"
|
|
9
9
|
}
|
|
@@ -54,13 +54,13 @@
|
|
|
54
54
|
],
|
|
55
55
|
"files": [
|
|
56
56
|
{
|
|
57
|
-
"name": "expo.modules.image-2.
|
|
58
|
-
"url": "expo.modules.image-2.
|
|
59
|
-
"size":
|
|
60
|
-
"sha512": "
|
|
61
|
-
"sha256": "
|
|
62
|
-
"sha1": "
|
|
63
|
-
"md5": "
|
|
57
|
+
"name": "expo.modules.image-2.4.0-canary-20250713-8f814f8.aar",
|
|
58
|
+
"url": "expo.modules.image-2.4.0-canary-20250713-8f814f8.aar",
|
|
59
|
+
"size": 293614,
|
|
60
|
+
"sha512": "5928b97432f974641d14f99976ddd03c1933731a6dc215222f3635e8fd3a93fc807eb2068ac61b5618ade31e881c73cba403dec7737c0ad5ea15b23e146c9b87",
|
|
61
|
+
"sha256": "28459572fbb29787a5b5eaab8cbec8d65ebcb8b1bff80d4b41020b76188714dc",
|
|
62
|
+
"sha1": "d892986ab6d024ecfd622bf341abc5e0852b67e6",
|
|
63
|
+
"md5": "987b16fc46ba4dfb8d53af2daf99fc7a"
|
|
64
64
|
}
|
|
65
65
|
]
|
|
66
66
|
},
|
|
@@ -143,13 +143,13 @@
|
|
|
143
143
|
],
|
|
144
144
|
"files": [
|
|
145
145
|
{
|
|
146
|
-
"name": "expo.modules.image-2.
|
|
147
|
-
"url": "expo.modules.image-2.
|
|
148
|
-
"size":
|
|
149
|
-
"sha512": "
|
|
150
|
-
"sha256": "
|
|
151
|
-
"sha1": "
|
|
152
|
-
"md5": "
|
|
146
|
+
"name": "expo.modules.image-2.4.0-canary-20250713-8f814f8.aar",
|
|
147
|
+
"url": "expo.modules.image-2.4.0-canary-20250713-8f814f8.aar",
|
|
148
|
+
"size": 293614,
|
|
149
|
+
"sha512": "5928b97432f974641d14f99976ddd03c1933731a6dc215222f3635e8fd3a93fc807eb2068ac61b5618ade31e881c73cba403dec7737c0ad5ea15b23e146c9b87",
|
|
150
|
+
"sha256": "28459572fbb29787a5b5eaab8cbec8d65ebcb8b1bff80d4b41020b76188714dc",
|
|
151
|
+
"sha1": "d892986ab6d024ecfd622bf341abc5e0852b67e6",
|
|
152
|
+
"md5": "987b16fc46ba4dfb8d53af2daf99fc7a"
|
|
153
153
|
}
|
|
154
154
|
]
|
|
155
155
|
},
|
|
@@ -163,13 +163,13 @@
|
|
|
163
163
|
},
|
|
164
164
|
"files": [
|
|
165
165
|
{
|
|
166
|
-
"name": "expo.modules.image-2.
|
|
167
|
-
"url": "expo.modules.image-2.
|
|
168
|
-
"size":
|
|
169
|
-
"sha512": "
|
|
170
|
-
"sha256": "
|
|
171
|
-
"sha1": "
|
|
172
|
-
"md5": "
|
|
166
|
+
"name": "expo.modules.image-2.4.0-canary-20250713-8f814f8-sources.jar",
|
|
167
|
+
"url": "expo.modules.image-2.4.0-canary-20250713-8f814f8-sources.jar",
|
|
168
|
+
"size": 66715,
|
|
169
|
+
"sha512": "5088775ebe8dbdd3636ae44627d45f466d3b26af289ccd64cc7f59a1db50045ec4c246dfacdfa80fdedd21b09f837215dd2f0843c8915c10afe74400ec3e626c",
|
|
170
|
+
"sha256": "047cf4256d9f1f9d37b874fe403d46abd838a59bbdf3d5b923d25b546242d99f",
|
|
171
|
+
"sha1": "f59c1a61e799d72cf2da93e51bdb6bfc76a1fecb",
|
|
172
|
+
"md5": "fb1a021a3c959caf9c844732221afe77"
|
|
173
173
|
}
|
|
174
174
|
]
|
|
175
175
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ab8018d2c5d5ffa5bd5955ea673d4c35
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
a2795a35433c43379b7d7ce4215c798d3b09cc42
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
15e74935002f0cfa1b14a35221699ae70a98f4e2a04dfc6308170c86fd2fb432
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0c24d72091a2260318e8f0634b73a786a68edcc3efa686ed3a9756740e2cf897073c54071530268629ab1f28eb461941a36303ed0ba4db5f6df5fba0cbf82fec
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
<modelVersion>4.0.0</modelVersion>
|
|
10
10
|
<groupId>BareExpo</groupId>
|
|
11
11
|
<artifactId>expo.modules.image</artifactId>
|
|
12
|
-
<version>2.
|
|
12
|
+
<version>2.4.0-canary-20250713-8f814f8</version>
|
|
13
13
|
<packaging>aar</packaging>
|
|
14
14
|
<name>expo.modules.image</name>
|
|
15
15
|
<url>https://github.com/expo/expo</url>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ebe2292114020700c6ef19086cf988c4
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
1e208717d87a1ba95f2a0f47e129733b80893de8
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
19e4200b968e5ea875ddfc5e6052016998164c079fe546219ac4c1694c32dad5
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
fbbb81d82cacda91b017192e2a95b7d6aae669ec1e6609d211d7ac571a74556e58e81ae5e626ea2ced1ce982dc42d9e76c797135572bcb06d282ef3e3e628a0b
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
<groupId>BareExpo</groupId>
|
|
4
4
|
<artifactId>expo.modules.image</artifactId>
|
|
5
5
|
<versioning>
|
|
6
|
-
<latest>2.
|
|
7
|
-
<release>2.
|
|
6
|
+
<latest>2.4.0-canary-20250713-8f814f8</latest>
|
|
7
|
+
<release>2.4.0-canary-20250713-8f814f8</release>
|
|
8
8
|
<versions>
|
|
9
|
-
<version>2.
|
|
9
|
+
<version>2.4.0-canary-20250713-8f814f8</version>
|
|
10
10
|
</versions>
|
|
11
|
-
<lastUpdated>
|
|
11
|
+
<lastUpdated>20250713133538</lastUpdated>
|
|
12
12
|
</versioning>
|
|
13
13
|
</metadata>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
d6635df55af7d2ba1eff1ad1cabd94cb
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
16df7592a0fa39f97c40e1947d02cfa8c5fb8c31
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
d67ddea608f829dca4e700dbe6b0625c8628f00983a9b7a19c7442dbff6a10c4
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
a8514f3b91eb7d052579211711b676e5889e0611caf3e5316355bdbe6d108236854ae7a4a5d52c90bf9e1e4d1f160fb64b832c37ff28a945156366485b3dd0cf
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-image",
|
|
3
3
|
"title": "Expo Image",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.4.0-canary-20250713-8f814f8",
|
|
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",
|
|
@@ -29,10 +29,10 @@
|
|
|
29
29
|
"license": "MIT",
|
|
30
30
|
"dependencies": {},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"expo-module-scripts": "4.1.
|
|
32
|
+
"expo-module-scripts": "4.1.10-canary-20250713-8f814f8"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
|
-
"expo": "54.0.0-canary-
|
|
35
|
+
"expo": "54.0.0-canary-20250713-8f814f8",
|
|
36
36
|
"react": "*",
|
|
37
37
|
"react-native": "*",
|
|
38
38
|
"react-native-web": "*"
|
package/src/Image.tsx
CHANGED
|
@@ -129,17 +129,18 @@ export class Image extends React.PureComponent<ImageProps> {
|
|
|
129
129
|
|
|
130
130
|
/**
|
|
131
131
|
* Asynchronously generates a [Blurhash](https://blurha.sh) from an image.
|
|
132
|
-
* @param
|
|
132
|
+
* @param source - The image source, either a URL (string) or an ImageRef
|
|
133
133
|
* @param numberOfComponents - The number of components to encode the blurhash with.
|
|
134
134
|
* Must be between 1 and 9. Defaults to `[4, 3]`.
|
|
135
|
+
* @platform android
|
|
135
136
|
* @platform ios
|
|
136
137
|
* @return A promise resolving to the blurhash string.
|
|
137
138
|
*/
|
|
138
139
|
static async generateBlurhashAsync(
|
|
139
|
-
|
|
140
|
+
source: string | ImageRef,
|
|
140
141
|
numberOfComponents: [number, number] | { width: number; height: number }
|
|
141
142
|
): Promise<string | null> {
|
|
142
|
-
return
|
|
143
|
+
return ImageModule.generateBlurhashAsync(source, numberOfComponents);
|
|
143
144
|
}
|
|
144
145
|
|
|
145
146
|
/**
|
package/src/Image.types.ts
CHANGED
|
@@ -362,6 +362,16 @@ export interface ImageProps extends Omit<ViewProps, 'style' | 'children'> {
|
|
|
362
362
|
* @platform ios
|
|
363
363
|
*/
|
|
364
364
|
useAppleWebpCodec?: boolean;
|
|
365
|
+
|
|
366
|
+
/**
|
|
367
|
+
* Force early resizing of the image to match the container size.
|
|
368
|
+
* This option helps to reduce the memory usage of the image view, especially when the image is larger than the container.
|
|
369
|
+
* It may affect the `resizeType` and `contentPosition` properties when the image view is resized dynamically.
|
|
370
|
+
*
|
|
371
|
+
* @default false
|
|
372
|
+
* @platform ios
|
|
373
|
+
*/
|
|
374
|
+
enforceEarlyResizing?: boolean;
|
|
365
375
|
}
|
|
366
376
|
|
|
367
377
|
/**
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
0dea771f25d26d1fe65aa2fc3511dc99
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
92ced973167a00d2e43b5d8f32835e9b9221e348
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
7212a71cec9495553fcd340b922ce49543d48c94167db4e0bad3d124f11abe48
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
b390278b08a6723df7fe1de078963025fba0da39d8465dfb3c2143d94e1c48b708d8cd4a9acbd5047914911ec3349cf0b5c65c649bebdec22f83b207ca2ec563
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
3b99ea2aa9e608ef7a20e25150c02ce9
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
4cec8f0d3433ef801d7f0665ccd4d91cf4bf89c4
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
a99a9a74a761f9275346efcc3aa8cd21371ea47f40e70a30fb97aceea0efd79b
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
36127dbb35f93f99de976ee879f558e72310881b9396dcaf4845de37c7aaeaa6419e7e59821555978f83d5ae60492b2a547e1077657d2f92ac5a3d4d5200748e
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
48dd96dc3f281ec7f6159d60c18f1224
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
58f24127ab6732e8eddf2e3c0352225421cf76b9
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
ee8f5b6275fa115f6ca3a5f8cdeff65fc979b087d8b3b51bcf08015ea9178aee
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
39c66dce93477e592bc0c4ba3294eb1b234e6d64b1738c6ab275c4742456507899cfade0af8ab07f5ab27b996c82a31dc8c45e1eb38216a3f6593dcf7c99c2df
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
fa99a589fe647e610895cad5b06560f4
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
61856390fac14aa7a1ef41c290e3bb216995e2e6
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
aba98e3f58fd540aa265b3ab706bba2fc7a5a92b17e0d7d797cebe6f23899c87
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
93829e1bcf87b0c49b66b561c12dea2883e91da9aefe59fadb3a142d95449dfcd8a4b817e681ecfffd0236b0f64aa9f0c40db2287c4b1b62c3b9cbf386be710c
|