expo-image 1.8.0 → 1.9.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/CHANGELOG.md +27 -0
- package/android/build.gradle +5 -3
- package/android/src/main/java/expo/modules/image/CustomDownsampleStrategy.kt +108 -0
- package/android/src/main/java/expo/modules/image/ExpoImageAppGlideModule.kt +8 -1
- package/android/src/main/java/expo/modules/image/ExpoImageModule.kt +15 -0
- package/android/src/main/java/expo/modules/image/ExpoImageViewWrapper.kt +15 -69
- package/android/src/main/java/expo/modules/image/events/GlideRequestListener.kt +3 -1
- package/android/src/main/java/expo/modules/image/records/SourceMap.kt +1 -1
- package/android/src/main/java/expo/modules/image/records/events.kt +2 -1
- package/build/Image.d.ts +2 -0
- package/build/Image.d.ts.map +1 -1
- package/build/Image.js +3 -1
- package/build/Image.js.map +1 -1
- package/build/Image.types.d.ts +6 -0
- package/build/Image.types.d.ts.map +1 -1
- package/build/Image.types.js.map +1 -1
- package/build/utils/AssetSourceResolver.web.d.ts +1 -1
- package/build/utils/AssetSourceResolver.web.d.ts.map +1 -1
- package/build/utils/AssetSourceResolver.web.js.map +1 -1
- package/build/utils/resolveAssetSource.web.js +1 -1
- package/build/utils/resolveAssetSource.web.js.map +1 -1
- package/ios/ExpoImage.podspec +1 -1
- package/ios/ImageModule.swift +1 -1
- package/ios/ImageView.swift +8 -0
- package/package.json +5 -3
- package/src/Image.tsx +3 -0
- package/src/Image.types.ts +6 -0
- package/src/utils/AssetSourceResolver.web.ts +1 -1
- package/src/utils/resolveAssetSource.web.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,21 @@
|
|
|
10
10
|
|
|
11
11
|
### 💡 Others
|
|
12
12
|
|
|
13
|
+
## 1.9.0 — 2023-11-14
|
|
14
|
+
|
|
15
|
+
### 🛠 Breaking changes
|
|
16
|
+
|
|
17
|
+
- Bumped iOS deployment target to 13.4. ([#25063](https://github.com/expo/expo/pull/25063) by [@gabrieldonadel](https://github.com/gabrieldonadel))
|
|
18
|
+
- On `Android` bump `compileSdkVersion` and `targetSdkVersion` to `34`. ([#24708](https://github.com/expo/expo/pull/24708) by [@alanjhughes](https://github.com/alanjhughes))
|
|
19
|
+
|
|
20
|
+
### 🎉 New features
|
|
21
|
+
|
|
22
|
+
- [Android] The stability of the memory cache key generation has been improved. ([#25372](https://github.com/expo/expo/pull/25372) by [@lukmccall](https://github.com/lukmccall))
|
|
23
|
+
|
|
24
|
+
### 💡 Others
|
|
25
|
+
|
|
26
|
+
- Collapse re-export of `react-native/Libraries/Image/AssetRegistry` to `@react-native/assets-registry/registry`. ([#25265](https://github.com/expo/expo/pull/25265) by [@EvanBacon](https://github.com/EvanBacon))
|
|
27
|
+
|
|
13
28
|
## 1.8.0 — 2023-11-13
|
|
14
29
|
|
|
15
30
|
### 🎉 New features
|
|
@@ -43,6 +58,18 @@
|
|
|
43
58
|
- [iOS] Fix compilation on tvOS. ([#25010](https://github.com/expo/expo/pull/25010) by [@douglowder](https://github.com/douglowder))
|
|
44
59
|
- [iOS] Fixed issue where some animated images would cause the app to hang ([#25008](https://github.com/expo/expo/pull/25008) by [@gkasdorf](https://github.com/gkasdorf))
|
|
45
60
|
|
|
61
|
+
## 1.6.1 — 2023-11-01
|
|
62
|
+
|
|
63
|
+
### 🐛 Bug fixes
|
|
64
|
+
|
|
65
|
+
- [Android] fix crash when loading local image files with no file extension ([#24201](https://github.com/expo/expo/pull/25032) by [@kadikraman](https://github.com/kadikraman))
|
|
66
|
+
|
|
67
|
+
## 1.3.5 — 2023-11-01
|
|
68
|
+
|
|
69
|
+
### 🐛 Bug fixes
|
|
70
|
+
|
|
71
|
+
- [Android] fix crash when loading local image files with no file extension ([#24201](https://github.com/expo/expo/pull/25032) by [@kadikraman](https://github.com/kadikraman))
|
|
72
|
+
|
|
46
73
|
## 1.6.0 — 2023-10-17
|
|
47
74
|
|
|
48
75
|
### 🛠 Breaking changes
|
package/android/build.gradle
CHANGED
|
@@ -40,11 +40,11 @@ buildscript {
|
|
|
40
40
|
android {
|
|
41
41
|
// Remove this if and it's contents, when support for SDK49 is dropped
|
|
42
42
|
if (!safeExtGet("expoProvidesDefaultConfig", false)) {
|
|
43
|
-
compileSdkVersion safeExtGet("compileSdkVersion",
|
|
43
|
+
compileSdkVersion safeExtGet("compileSdkVersion", 34)
|
|
44
44
|
|
|
45
45
|
defaultConfig {
|
|
46
46
|
minSdkVersion safeExtGet("minSdkVersion", 23)
|
|
47
|
-
targetSdkVersion safeExtGet("targetSdkVersion",
|
|
47
|
+
targetSdkVersion safeExtGet("targetSdkVersion", 34)
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
lintOptions {
|
|
@@ -67,8 +67,10 @@ android {
|
|
|
67
67
|
namespace "expo.modules.image"
|
|
68
68
|
defaultConfig {
|
|
69
69
|
versionCode 1
|
|
70
|
-
versionName "1.
|
|
70
|
+
versionName "1.9.0"
|
|
71
71
|
consumerProguardFiles("proguard-rules.pro")
|
|
72
|
+
|
|
73
|
+
buildConfigField("boolean", "ALLOW_GLIDE_LOGS", project.properties.get("EXPO_ALLOW_GLIDE_LOGS", "false"))
|
|
72
74
|
}
|
|
73
75
|
publishing {
|
|
74
76
|
singleVariant("release") {
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
package expo.modules.image
|
|
2
|
+
|
|
3
|
+
import com.bumptech.glide.load.resource.bitmap.DownsampleStrategy
|
|
4
|
+
import com.bumptech.glide.request.target.Target
|
|
5
|
+
import expo.modules.image.enums.ContentFit
|
|
6
|
+
import kotlin.math.min
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Glide uses `hashCode` and `equals` of the `DownsampleStrategy` to calculate the cache key.
|
|
10
|
+
* However, we generate this object dynamically, which means that each instance will be different.
|
|
11
|
+
* Unfortunately, this behaviour is not correct since Glide will not load
|
|
12
|
+
* the image from memory no matter what.
|
|
13
|
+
* To fix this issue, we set the `hashCode` to a fixed number and
|
|
14
|
+
* override `equals` to only check if objects have the common type.
|
|
15
|
+
*/
|
|
16
|
+
abstract class CustomDownsampleStrategy : DownsampleStrategy() {
|
|
17
|
+
override fun equals(other: Any?): Boolean {
|
|
18
|
+
return other is CustomDownsampleStrategy
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
override fun hashCode(): Int {
|
|
22
|
+
return 302008237
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
class NoopDownsampleStrategy : DownsampleStrategy() {
|
|
27
|
+
override fun getScaleFactor(
|
|
28
|
+
sourceWidth: Int,
|
|
29
|
+
sourceHeight: Int,
|
|
30
|
+
requestedWidth: Int,
|
|
31
|
+
requestedHeight: Int
|
|
32
|
+
): Float = 1f
|
|
33
|
+
|
|
34
|
+
override fun getSampleSizeRounding(
|
|
35
|
+
sourceWidth: Int,
|
|
36
|
+
sourceHeight: Int,
|
|
37
|
+
requestedWidth: Int,
|
|
38
|
+
requestedHeight: Int
|
|
39
|
+
): SampleSizeRounding = SampleSizeRounding.QUALITY
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
class ContentFitDownsampleStrategy(private val target: ImageViewWrapperTarget, private val contentFit: ContentFit) : CustomDownsampleStrategy() {
|
|
43
|
+
private var wasTriggered = false
|
|
44
|
+
override fun getScaleFactor(
|
|
45
|
+
sourceWidth: Int,
|
|
46
|
+
sourceHeight: Int,
|
|
47
|
+
requestedWidth: Int,
|
|
48
|
+
requestedHeight: Int
|
|
49
|
+
): Float {
|
|
50
|
+
// The method is invoked twice per asset, but we only need to preserve the original dimensions for the first call.
|
|
51
|
+
// As Glide uses Android downsampling, it can only adjust dimensions by a factor of two,
|
|
52
|
+
// and hence two distinct scaling factors are computed to achieve greater accuracy.
|
|
53
|
+
if (!wasTriggered) {
|
|
54
|
+
target.sourceWidth = sourceWidth
|
|
55
|
+
target.sourceHeight = sourceHeight
|
|
56
|
+
wasTriggered = true
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// The size of the container is unknown, we don't know what to do, so we just run the default scale.
|
|
60
|
+
if (requestedWidth == Target.SIZE_ORIGINAL || requestedHeight == Target.SIZE_ORIGINAL) {
|
|
61
|
+
return 1f
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
val aspectRation = calculateScaleFactor(
|
|
65
|
+
sourceWidth.toFloat(),
|
|
66
|
+
sourceHeight.toFloat(),
|
|
67
|
+
requestedWidth.toFloat(),
|
|
68
|
+
requestedHeight.toFloat()
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
// We don't want to upscale the image
|
|
72
|
+
return min(1f, aspectRation)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
private fun calculateScaleFactor(
|
|
76
|
+
sourceWidth: Float,
|
|
77
|
+
sourceHeight: Float,
|
|
78
|
+
requestedWidth: Float,
|
|
79
|
+
requestedHeight: Float
|
|
80
|
+
): Float = when (contentFit) {
|
|
81
|
+
ContentFit.Contain -> min(
|
|
82
|
+
requestedWidth / sourceWidth,
|
|
83
|
+
requestedHeight / sourceHeight
|
|
84
|
+
)
|
|
85
|
+
ContentFit.Cover -> java.lang.Float.max(
|
|
86
|
+
requestedWidth / sourceWidth,
|
|
87
|
+
requestedHeight / sourceHeight
|
|
88
|
+
)
|
|
89
|
+
ContentFit.Fill, ContentFit.None -> 1f
|
|
90
|
+
ContentFit.ScaleDown -> if (requestedWidth < sourceWidth || requestedHeight < sourceHeight) {
|
|
91
|
+
// The container is smaller than the image — scale it down and behave like `contain`
|
|
92
|
+
min(
|
|
93
|
+
requestedWidth / sourceWidth,
|
|
94
|
+
requestedHeight / sourceHeight
|
|
95
|
+
)
|
|
96
|
+
} else {
|
|
97
|
+
// The container is bigger than the image — don't scale it and behave like `none`
|
|
98
|
+
1f
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
override fun getSampleSizeRounding(
|
|
103
|
+
sourceWidth: Int,
|
|
104
|
+
sourceHeight: Int,
|
|
105
|
+
requestedWidth: Int,
|
|
106
|
+
requestedHeight: Int
|
|
107
|
+
) = SampleSizeRounding.QUALITY
|
|
108
|
+
}
|
|
@@ -14,6 +14,13 @@ import com.bumptech.glide.module.AppGlideModule
|
|
|
14
14
|
class ExpoImageAppGlideModule : AppGlideModule() {
|
|
15
15
|
override fun applyOptions(context: Context, builder: GlideBuilder) {
|
|
16
16
|
super.applyOptions(context, builder)
|
|
17
|
-
|
|
17
|
+
|
|
18
|
+
builder.setLogLevel(
|
|
19
|
+
if (BuildConfig.ALLOW_GLIDE_LOGS) {
|
|
20
|
+
Log.VERBOSE
|
|
21
|
+
} else {
|
|
22
|
+
Log.ERROR
|
|
23
|
+
}
|
|
24
|
+
)
|
|
18
25
|
}
|
|
19
26
|
}
|
|
@@ -40,6 +40,9 @@ class ExpoImageModule : Module() {
|
|
|
40
40
|
Glide
|
|
41
41
|
.with(context)
|
|
42
42
|
.load(GlideUrl(it)) // Use `load` instead of `download` to store the asset in the memory cache
|
|
43
|
+
// We added `quality` and `downsample` to create the same cache key as in final image load.
|
|
44
|
+
.encodeQuality(100)
|
|
45
|
+
.downsample(NoopDownsampleStrategy())
|
|
43
46
|
.apply {
|
|
44
47
|
if (cachePolicy == CachePolicy.MEMORY) {
|
|
45
48
|
diskCacheStrategy(DiskCacheStrategy.NONE)
|
|
@@ -232,6 +235,18 @@ class ExpoImageModule : Module() {
|
|
|
232
235
|
view.allowDownscaling = allowDownscaling ?: true
|
|
233
236
|
}
|
|
234
237
|
|
|
238
|
+
Prop("autoplay") { view: ExpoImageViewWrapper, autoplay: Boolean? ->
|
|
239
|
+
view.autoplay = autoplay ?: true
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
AsyncFunction("startAnimating") { view: ExpoImageViewWrapper ->
|
|
243
|
+
view.setIsAnimating(true)
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
AsyncFunction("stopAnimating") { view: ExpoImageViewWrapper ->
|
|
247
|
+
view.setIsAnimating(false)
|
|
248
|
+
}
|
|
249
|
+
|
|
235
250
|
OnViewDidUpdateProps { view: ExpoImageViewWrapper ->
|
|
236
251
|
view.rerenderIfNeeded()
|
|
237
252
|
}
|
|
@@ -18,7 +18,6 @@ import com.bumptech.glide.RequestManager
|
|
|
18
18
|
import com.bumptech.glide.load.engine.DiskCacheStrategy
|
|
19
19
|
import com.bumptech.glide.load.resource.bitmap.DownsampleStrategy
|
|
20
20
|
import com.bumptech.glide.request.RequestOptions
|
|
21
|
-
import com.bumptech.glide.request.target.Target.SIZE_ORIGINAL
|
|
22
21
|
import com.facebook.yoga.YogaConstants
|
|
23
22
|
import expo.modules.image.enums.ContentFit
|
|
24
23
|
import expo.modules.image.enums.Priority
|
|
@@ -38,7 +37,6 @@ import expo.modules.kotlin.tracing.trace
|
|
|
38
37
|
import expo.modules.kotlin.viewevent.EventDispatcher
|
|
39
38
|
import expo.modules.kotlin.views.ExpoView
|
|
40
39
|
import jp.wasabeef.glide.transformations.BlurTransformation
|
|
41
|
-
import java.lang.Float.max
|
|
42
40
|
import java.lang.ref.WeakReference
|
|
43
41
|
import kotlin.math.abs
|
|
44
42
|
import kotlin.math.min
|
|
@@ -162,6 +160,8 @@ class ExpoImageViewWrapper(context: Context, appContext: AppContext) : ExpoView(
|
|
|
162
160
|
shouldRerender = true
|
|
163
161
|
}
|
|
164
162
|
|
|
163
|
+
internal var autoplay: Boolean = true
|
|
164
|
+
|
|
165
165
|
internal var priority: Priority = Priority.NORMAL
|
|
166
166
|
internal var cachePolicy: CachePolicy = CachePolicy.DISK
|
|
167
167
|
|
|
@@ -184,6 +184,18 @@ class ExpoImageViewWrapper(context: Context, appContext: AppContext) : ExpoView(
|
|
|
184
184
|
activeView.setBorderColor(index, rgb, alpha)
|
|
185
185
|
}
|
|
186
186
|
|
|
187
|
+
fun setIsAnimating(setAnimating: Boolean) {
|
|
188
|
+
val resource = activeView.drawable
|
|
189
|
+
|
|
190
|
+
if (resource is Animatable) {
|
|
191
|
+
if (setAnimating) {
|
|
192
|
+
resource.start()
|
|
193
|
+
} else {
|
|
194
|
+
resource.stop()
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
187
199
|
/**
|
|
188
200
|
* Whether the image should be loaded again
|
|
189
201
|
*/
|
|
@@ -495,73 +507,7 @@ class ExpoImageViewWrapper(context: Context, appContext: AppContext) : ExpoView(
|
|
|
495
507
|
newTarget.hasSource = sourceToLoad != null
|
|
496
508
|
|
|
497
509
|
val downsampleStrategy = if (allowDownscaling) {
|
|
498
|
-
|
|
499
|
-
var wasTriggered = false
|
|
500
|
-
override fun getScaleFactor(
|
|
501
|
-
sourceWidth: Int,
|
|
502
|
-
sourceHeight: Int,
|
|
503
|
-
requestedWidth: Int,
|
|
504
|
-
requestedHeight: Int
|
|
505
|
-
): Float {
|
|
506
|
-
// The method is invoked twice per asset, but we only need to preserve the original dimensions for the first call.
|
|
507
|
-
// As Glide uses Android downsampling, it can only adjust dimensions by a factor of two,
|
|
508
|
-
// and hence two distinct scaling factors are computed to achieve greater accuracy.
|
|
509
|
-
if (!wasTriggered) {
|
|
510
|
-
newTarget.sourceWidth = sourceWidth
|
|
511
|
-
newTarget.sourceHeight = sourceHeight
|
|
512
|
-
wasTriggered = true
|
|
513
|
-
}
|
|
514
|
-
|
|
515
|
-
// The size of the container is unknown, we don't know what to do, so we just run the default scale.
|
|
516
|
-
if (requestedWidth == SIZE_ORIGINAL || requestedHeight == SIZE_ORIGINAL) {
|
|
517
|
-
return 1f
|
|
518
|
-
}
|
|
519
|
-
|
|
520
|
-
val aspectRation = calculateScaleFactor(
|
|
521
|
-
sourceWidth.toFloat(),
|
|
522
|
-
sourceHeight.toFloat(),
|
|
523
|
-
requestedWidth.toFloat(),
|
|
524
|
-
requestedHeight.toFloat()
|
|
525
|
-
)
|
|
526
|
-
|
|
527
|
-
// We don't want to upscale the image
|
|
528
|
-
return min(1f, aspectRation)
|
|
529
|
-
}
|
|
530
|
-
|
|
531
|
-
private fun calculateScaleFactor(
|
|
532
|
-
sourceWidth: Float,
|
|
533
|
-
sourceHeight: Float,
|
|
534
|
-
requestedWidth: Float,
|
|
535
|
-
requestedHeight: Float
|
|
536
|
-
): Float = when (contentFit) {
|
|
537
|
-
ContentFit.Contain -> min(
|
|
538
|
-
requestedWidth / sourceWidth,
|
|
539
|
-
requestedHeight / sourceHeight
|
|
540
|
-
)
|
|
541
|
-
ContentFit.Cover -> max(
|
|
542
|
-
requestedWidth / sourceWidth,
|
|
543
|
-
requestedHeight / sourceHeight
|
|
544
|
-
)
|
|
545
|
-
ContentFit.Fill, ContentFit.None -> 1f
|
|
546
|
-
ContentFit.ScaleDown -> if (requestedWidth < sourceWidth || requestedHeight < sourceHeight) {
|
|
547
|
-
// The container is smaller than the image — scale it down and behave like `contain`
|
|
548
|
-
min(
|
|
549
|
-
requestedWidth / sourceWidth,
|
|
550
|
-
requestedHeight / sourceHeight
|
|
551
|
-
)
|
|
552
|
-
} else {
|
|
553
|
-
// The container is bigger than the image — don't scale it and behave like `none`
|
|
554
|
-
1f
|
|
555
|
-
}
|
|
556
|
-
}
|
|
557
|
-
|
|
558
|
-
override fun getSampleSizeRounding(
|
|
559
|
-
sourceWidth: Int,
|
|
560
|
-
sourceHeight: Int,
|
|
561
|
-
requestedWidth: Int,
|
|
562
|
-
requestedHeight: Int
|
|
563
|
-
) = SampleSizeRounding.QUALITY
|
|
564
|
-
}
|
|
510
|
+
ContentFitDownsampleStrategy(newTarget, contentFit)
|
|
565
511
|
} else {
|
|
566
512
|
DownsampleStrategy.NONE
|
|
567
513
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
package expo.modules.image.events
|
|
2
2
|
|
|
3
|
+
import android.graphics.drawable.Animatable
|
|
3
4
|
import android.graphics.drawable.Drawable
|
|
4
5
|
import android.util.Log
|
|
5
6
|
import com.bumptech.glide.load.DataSource
|
|
@@ -57,7 +58,8 @@ class GlideRequestListener(
|
|
|
57
58
|
url = model.toString(),
|
|
58
59
|
width = intrinsicWidth,
|
|
59
60
|
height = intrinsicHeight,
|
|
60
|
-
mediaType = null // TODO(@lukmccall): add mediaType
|
|
61
|
+
mediaType = null, // TODO(@lukmccall): add mediaType
|
|
62
|
+
isAnimated = resource is Animatable
|
|
61
63
|
)
|
|
62
64
|
)
|
|
63
65
|
)
|
|
@@ -52,7 +52,7 @@ data class SourceMap(
|
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
val lastDotIndex = uri?.lastIndexOf('.')
|
|
56
56
|
// if the path has no file extension and no . at all (e.g. file://path/to/file) return false
|
|
57
57
|
if (lastDotIndex == -1 || lastDotIndex == null) {
|
|
58
58
|
return false
|
package/build/Image.d.ts
CHANGED
|
@@ -46,11 +46,13 @@ export declare class Image extends React.PureComponent<ImageProps> {
|
|
|
46
46
|
static getCachePathAsync(cacheKey: string): Promise<string | null>;
|
|
47
47
|
/**
|
|
48
48
|
* Asynchronously starts playback of the view's image if it is animated.
|
|
49
|
+
* @platform android
|
|
49
50
|
* @platform ios
|
|
50
51
|
*/
|
|
51
52
|
startAnimating(): Promise<void>;
|
|
52
53
|
/**
|
|
53
54
|
* Asynchronously stops the playback of the view's image if it is animated.
|
|
55
|
+
* @platform android
|
|
54
56
|
* @platform ios
|
|
55
57
|
*/
|
|
56
58
|
stopAnimating(): Promise<void>;
|
package/build/Image.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Image.d.ts","sourceRoot":"","sources":["../src/Image.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAM3C,qBAAa,KAAM,SAAQ,KAAK,CAAC,aAAa,CAAC,UAAU,CAAC;IACxD,aAAa,MAAC;gBAEF,KAAK,KAAA;IAKjB;;;;;;;;;;OAUG;WACU,QAAQ,CACnB,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,EACvB,WAAW,GAAE,aAAa,GAAG,QAAwB,GACpD,OAAO,CAAC,OAAO,CAAC;IAInB;;;;;;;OAOG;WACU,gBAAgB,IAAI,OAAO,CAAC,OAAO,CAAC;IAIjD;;;;;;;OAOG;WACU,cAAc,IAAI,OAAO,CAAC,OAAO,CAAC;IAI/C;;;;;;;;;OASG;WACU,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAIxE
|
|
1
|
+
{"version":3,"file":"Image.d.ts","sourceRoot":"","sources":["../src/Image.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAM3C,qBAAa,KAAM,SAAQ,KAAK,CAAC,aAAa,CAAC,UAAU,CAAC;IACxD,aAAa,MAAC;gBAEF,KAAK,KAAA;IAKjB;;;;;;;;;;OAUG;WACU,QAAQ,CACnB,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,EACvB,WAAW,GAAE,aAAa,GAAG,QAAwB,GACpD,OAAO,CAAC,OAAO,CAAC;IAInB;;;;;;;OAOG;WACU,gBAAgB,IAAI,OAAO,CAAC,OAAO,CAAC;IAIjD;;;;;;;OAOG;WACU,cAAc,IAAI,OAAO,CAAC,OAAO,CAAC;IAI/C;;;;;;;;;OASG;WACU,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAIxE;;;;OAIG;IACG,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;IAIrC;;;;OAIG;IACG,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;IAIpC,MAAM;CAsCP"}
|
package/build/Image.js
CHANGED
|
@@ -61,6 +61,7 @@ export class Image extends React.PureComponent {
|
|
|
61
61
|
}
|
|
62
62
|
/**
|
|
63
63
|
* Asynchronously starts playback of the view's image if it is animated.
|
|
64
|
+
* @platform android
|
|
64
65
|
* @platform ios
|
|
65
66
|
*/
|
|
66
67
|
async startAnimating() {
|
|
@@ -68,6 +69,7 @@ export class Image extends React.PureComponent {
|
|
|
68
69
|
}
|
|
69
70
|
/**
|
|
70
71
|
* Asynchronously stops the playback of the view's image if it is animated.
|
|
72
|
+
* @platform android
|
|
71
73
|
* @platform ios
|
|
72
74
|
*/
|
|
73
75
|
async stopAnimating() {
|
|
@@ -81,7 +83,7 @@ export class Image extends React.PureComponent {
|
|
|
81
83
|
console.warn('[expo-image]: `defaultSource` and `loadingIndicatorSource` props are deprecated, use `placeholder` instead');
|
|
82
84
|
loggedDefaultSourceDeprecationWarning = true;
|
|
83
85
|
}
|
|
84
|
-
return (<ExpoImage {...restProps} style={restStyle} source={resolveSources(source)} placeholder={resolveSources(placeholder ?? defaultSource ?? loadingIndicatorSource)} contentFit={resolveContentFit(contentFit, resizeMode)} contentPosition={resolveContentPosition(contentPosition)} transition={resolveTransition(transition, fadeDuration)}/>);
|
|
86
|
+
return (<ExpoImage {...restProps} style={restStyle} source={resolveSources(source)} placeholder={resolveSources(placeholder ?? defaultSource ?? loadingIndicatorSource)} contentFit={resolveContentFit(contentFit, resizeMode)} contentPosition={resolveContentPosition(contentPosition)} transition={resolveTransition(transition, fadeDuration)} nativeViewRef={this.nativeViewRef}/>);
|
|
85
87
|
}
|
|
86
88
|
}
|
|
87
89
|
//# sourceMappingURL=Image.js.map
|
package/build/Image.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Image.js","sourceRoot":"","sources":["../src/Image.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,SAAS,EAAE,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEzD,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AACvF,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExD,IAAI,qC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EACtB,GAAG,SAAS,EACb,GAAG,IAAI,CAAC,KAAK,CAAC;QAEf,MAAM,EAAE,UAAU,EAAE,eAAe,EAAE,GAAG,SAAS,EAAE,GAAG,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;QACtF,MAAM,UAAU,GAAG,cAAc,IAAI,eAAe,CAAC;QAErD,IAAI,CAAC,aAAa,IAAI,sBAAsB,CAAC,IAAI,CAAC,qCAAqC,EAAE;YACvF,OAAO,CAAC,IAAI,CACV,4GAA4G,CAC7G,CAAC;YACF,qCAAqC,GAAG,IAAI,CAAC;SAC9C;QAED,OAAO,CACL,CAAC,SAAS,CACR,IAAI,SAAS,CAAC,CACd,KAAK,CAAC,CAAC,SAAS,CAAC,CACjB,MAAM,CAAC,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAC/B,WAAW,CAAC,CAAC,cAAc,CAAC,WAAW,IAAI,aAAa,IAAI,sBAAsB,CAAC,CAAC,CACpF,UAAU,CAAC,CAAC,iBAAiB,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC,CACtD,eAAe,CAAC,CAAC,sBAAsB,CAAC,eAAe,CAAC,CAAC,CACzD,UAAU,CAAC,CAAC,iBAAiB,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC,CACxD,aAAa,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,EAClC,CACH,CAAC;IACJ,CAAC;CACF","sourcesContent":["import React from 'react';\nimport { StyleSheet } from 'react-native';\n\nimport ExpoImage, { ExpoImageModule } from './ExpoImage';\nimport { ImageProps } from './Image.types';\nimport { resolveContentFit, resolveContentPosition, resolveTransition } from './utils';\nimport { resolveSources } from './utils/resolveSources';\n\nlet loggedDefaultSourceDeprecationWarning = false;\n\nexport class Image extends React.PureComponent<ImageProps> {\n nativeViewRef;\n\n constructor(props) {\n super(props);\n this.nativeViewRef = React.createRef();\n }\n\n /**\n * Preloads images at the given URLs that can be later used in the image view.\n * Preloaded images are cached to the memory and disk by default, so make sure\n * to use `disk` (default) or `memory-disk` [cache policy](#cachepolicy).\n * @param urls - A URL string or an array of URLs of images to prefetch.\n * @param cachePolicy - The cache policy for prefetched images.\n * @return A promise resolving to `true` as soon as all images have been\n * successfully prefetched. If an image fails to be prefetched, the promise\n * will immediately resolve to `false` regardless of whether other images have\n * finished prefetching.\n */\n static async prefetch(\n urls: string | string[],\n cachePolicy: 'memory-disk' | 'memory' = 'memory-disk'\n ): Promise<boolean> {\n return ExpoImageModule.prefetch(Array.isArray(urls) ? urls : [urls], cachePolicy);\n }\n\n /**\n * Asynchronously clears all images stored in memory.\n * @platform android\n * @platform ios\n * @return A promise resolving to `true` when the operation succeeds.\n * It may resolve to `false` on Android when the activity is no longer available.\n * Resolves to `false` on Web.\n */\n static async clearMemoryCache(): Promise<boolean> {\n return await ExpoImageModule.clearMemoryCache();\n }\n\n /**\n * Asynchronously clears all images from the disk cache.\n * @platform android\n * @platform ios\n * @return A promise resolving to `true` when the operation succeeds.\n * It may resolve to `false` on Android when the activity is no longer available.\n * Resolves to `false` on Web.\n */\n static async clearDiskCache(): Promise<boolean> {\n return await ExpoImageModule.clearDiskCache();\n }\n\n /**\n * Asynchronously checks if an image exists in the disk cache and resolves to\n * the path of the cached image if it does.\n * @param cacheKey - The cache key for the requested image. Unless you have set\n * a custom cache key, this will be the source URL of the image.\n * @platform android\n * @platform ios\n * @return A promise resolving to the path of the cached image. It will resolve\n * to `null` if the image does not exist in the cache.\n */\n static async getCachePathAsync(cacheKey: string): Promise<string | null> {\n return await ExpoImageModule.getCachePathAsync(cacheKey);\n }\n\n /**\n * Asynchronously starts playback of the view's image if it is animated.\n * @platform android\n * @platform ios\n */\n async startAnimating(): Promise<void> {\n await this.nativeViewRef.current.startAnimating();\n }\n\n /**\n * Asynchronously stops the playback of the view's image if it is animated.\n * @platform android\n * @platform ios\n */\n async stopAnimating(): Promise<void> {\n await this.nativeViewRef.current.stopAnimating();\n }\n\n render() {\n const {\n style,\n source,\n placeholder,\n contentFit,\n contentPosition,\n transition,\n fadeDuration,\n resizeMode: resizeModeProp,\n defaultSource,\n loadingIndicatorSource,\n ...restProps\n } = this.props;\n\n const { resizeMode: resizeModeStyle, ...restStyle } = StyleSheet.flatten(style) || {};\n const resizeMode = resizeModeProp ?? resizeModeStyle;\n\n if ((defaultSource || loadingIndicatorSource) && !loggedDefaultSourceDeprecationWarning) {\n console.warn(\n '[expo-image]: `defaultSource` and `loadingIndicatorSource` props are deprecated, use `placeholder` instead'\n );\n loggedDefaultSourceDeprecationWarning = true;\n }\n\n return (\n <ExpoImage\n {...restProps}\n style={restStyle}\n source={resolveSources(source)}\n placeholder={resolveSources(placeholder ?? defaultSource ?? loadingIndicatorSource)}\n contentFit={resolveContentFit(contentFit, resizeMode)}\n contentPosition={resolveContentPosition(contentPosition)}\n transition={resolveTransition(transition, fadeDuration)}\n nativeViewRef={this.nativeViewRef}\n />\n );\n }\n}\n"]}
|
package/build/Image.types.d.ts
CHANGED
|
@@ -46,6 +46,12 @@ export type ImageSource = {
|
|
|
46
46
|
* @platform web
|
|
47
47
|
*/
|
|
48
48
|
webMaxViewportWidth?: number;
|
|
49
|
+
/**
|
|
50
|
+
* Whether the image is animated (an animated GIF or WebP for example).
|
|
51
|
+
* @platform android
|
|
52
|
+
* @platform ios
|
|
53
|
+
*/
|
|
54
|
+
isAnimated?: boolean;
|
|
49
55
|
};
|
|
50
56
|
/**
|
|
51
57
|
* @hidden
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Image.types.d.ts","sourceRoot":"","sources":["../src/Image.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,IAAI,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE3F,OAAO,SAAS,MAAM,aAAa,CAAC;AAEpC,MAAM,MAAM,WAAW,GAAG;IACxB;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,OAAO,CAAC,EA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AI,CAAC,SAAS,MAAM,GAAG,CAAC,GAAG,KAAK,CAAC;AAElD;;GAEG;AACH,MAAM,MAAM,0BAA0B,GAAG,UAAU,CAAC,oBAAoB,CAAC,CAAC;AAE1E;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,MAAM,CAAC,EAAE,aAAa,GAAG,SAAS,GAAG,UAAU,GAAG,QAAQ,CAAC;IAE3D;;;;;;OAMG;IACH,MAAM,CAAC,EACH,gBAAgB,GAChB,eAAe,GACf,iBAAiB,GACjB,kBAAkB,GAClB,gBAAgB,GAChB,SAAS,GACT,WAAW,GACX,IAAI,CAAC;CACV,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,QAAQ,CAAC;IACtC,MAAM,EAAE;QACN,GAAG,EAAE,MAAM,CAAC;QACZ,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;QACf,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;QACzB,UAAU,CAAC,EAAE,OAAO,CAAC;KACtB,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,KAAK,EAAE,MAAM,CAAC;CACf,CAAC"}
|
package/build/Image.types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Image.types.js","sourceRoot":"","sources":["../src/Image.types.ts"],"names":[],"mappings":"","sourcesContent":["import { ImageStyle as RNImageStyle, ViewProps, StyleProp, ViewStyle } from 'react-native';\n\nimport ExpoImage from './ExpoImage';\n\nexport type ImageSource = {\n /**\n * A string representing the resource identifier for the image,\n * which could be an http address, a local file path, or the name of a static image resource.\n */\n uri?: string;\n /**\n * An object representing the HTTP headers to send along with the request for a remote image.\n * On web requires the `Access-Control-Allow-Origin` header returned by the server to include the current domain.\n */\n headers?: Record<string, string>;\n /**\n * Can be specified if known at build time, in which case the value\n * will be used to set the default `<Image/>` component dimension\n */\n width?: number;\n /**\n * Can be specified if known at build time, in which case the value\n * will be used to set the default `<Image/>` component dimension\n */\n height?: number;\n\n /**\n * The blurhash string to use to generate the image. You can read more about the blurhash\n * on [`woltapp/blurhash`](https://github.com/woltapp/blurhash) repo. Ignored when `uri` is provided.\n * When using the blurhash, you should also provide `width` and `height` (higher values reduce performance),\n * otherwise their default value is `16`.\n */\n blurhash?: string;\n\n /**\n * The thumbhash string to use to generate the image placeholder. You can read more about thumbhash\n * on the [`thumbhash website`](https://evanw.github.io/thumbhash/). Ignored when `uri` is provided.\n */\n thumbhash?: string;\n\n /**\n * The cache key used to query and store this specific image.\n * If not provided, the `uri` is used also as the cache key.\n */\n cacheKey?: string;\n /**\n * The max width of the viewport for which this source should be selected.\n * Has no effect if `source` prop is not an array or has only 1 element.\n * Has no effect if `responsivePolicy` is not set to `static`.\n * Ignored if `blurhash` or `thumbhash` is provided (image hashes are never selected if passed in an array).\n * @platform web\n */\n webMaxViewportWidth?: number;\n};\n\n/**\n * @hidden\n */\nexport type ImageStyle = RNImageStyle;\n\n/**\n * Determines how the image should be resized to fit its container.\n * @hidden Described in the {@link ImageProps['contentFit']}\n */\nexport type ImageContentFit = 'cover' | 'contain' | 'fill' | 'none' | 'scale-down';\n\n/**\n * Some props are from React Native Image that Expo Image supports (more or less) for easier migration,\n * but all of them are deprecated and might be removed in the future.\n */\nexport interface ImageProps extends ViewProps {\n /** @hidden */\n style?: StyleProp<RNImageStyle>;\n\n /**\n * The image source, either a remote URL, a local file resource or a number that is the result of the `require()` function.\n * When provided as an array of sources, the source that fits best into the container size and is closest to the screen scale\n * will be chosen. In this case it is important to provide `width`, `height` and `scale` properties.\n */\n source?: ImageSource | string | number | ImageSource[] | string[] | null;\n\n /**\n * An image to display while loading the proper image and no image has been displayed yet or the source is unset.\n */\n placeholder?: ImageSource | string | number | ImageSource[] | string[] | null;\n\n /**\n * Determines how the image should be resized to fit its container. This property tells the image to fill the container\n * in a variety of ways; such as \"preserve that aspect ratio\" or \"stretch up and take up as much space as possible\".\n * It mirrors the CSS [`object-fit`](https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit) property.\n *\n * - `'cover'` - The image is sized to maintain its aspect ratio while filling the container box.\n * If the image's aspect ratio does not match the aspect ratio of its box, then the object will be clipped to fit.\n *\n * - `'contain'` - The image is scaled down or up to maintain its aspect ratio while fitting within the container box.\n *\n * - `'fill'` - The image is sized to entirely fill the container box. If necessary, the image will be stretched or squished to fit.\n *\n * - `'none'` - The image is not resized and is centered by default.\n * When specified, the exact position can be controlled with [`contentPosition`](#contentposition) prop.\n *\n * - `'scale-down'` - The image is sized as if `none` or `contain` were specified, whichever would result in a smaller concrete image size.\n *\n * @default 'cover'\n */\n contentFit?: ImageContentFit;\n\n /**\n * Determines how the placeholder should be resized to fit its container. Available resize modes are the same as for the [`contentFit`](#contentfit) prop.\n * @default 'scale-down'\n */\n placeholderContentFit?: ImageContentFit;\n\n /**\n * It is used together with [`contentFit`](#contentfit) to specify how the image should be positioned with x/y coordinates inside its own container.\n * An equivalent of the CSS [`object-position`](https://developer.mozilla.org/en-US/docs/Web/CSS/object-position) property.\n * @default 'center'\n */\n contentPosition?: ImageContentPosition;\n\n /**\n * Describes how the image view should transition the contents when switching the image source.\\\n * If provided as a number, it is the duration in milliseconds of the `'cross-dissolve'` effect.\n */\n transition?: ImageTransition | number | null;\n\n /**\n * The radius of the blur in points, `0` means no blur effect.\n * This effect is not applied to placeholders.\n * @default 0\n */\n blurRadius?: number;\n\n /**\n * A color used to tint template images (a bitmap image where only the opacity matters).\n * The color is applied to every non-transparent pixel, causing the image’s shape to adopt that color.\n * This effect is not applied to placeholders.\n * @default null\n */\n tintColor?: string | null;\n\n /**\n * Priorities for completing loads. If more than one load is queued at a time,\n * the load with the higher priority will be started first.\n * Priorities are considered best effort, there are no guarantees about the order in which loads will start or finish.\n * @default 'normal'\n */\n priority?: 'low' | 'normal' | 'high' | null;\n\n /**\n * Determines whether to cache the image and where: on the disk, in the memory or both.\n *\n * - `'none'` - Image is not cached at all.\n *\n * - `'disk'` - Image is queried from the disk cache if exists, otherwise it's downloaded and then stored on the disk.\n *\n * - `'memory'` - Image is cached in memory. Might be useful when you render a high-resolution picture many times.\n * Memory cache may be purged very quickly to prevent high memory usage and the risk of out of memory exceptions.\n *\n * - `'memory-disk'` - Image is cached in memory, but with a fallback to the disk cache.\n *\n * @default 'disk'\n */\n cachePolicy?: 'none' | 'disk' | 'memory' | 'memory-disk' | /** @hidden */ null;\n\n /**\n * Controls the selection of the image source based on the container or viewport size on the web.\n *\n * If set to `'static'`, the browser selects the correct source based on user's viewport width. Works with static rendering.\n * Make sure to set the `'webMaxViewportWidth'` property on each source for best results.\n * For example, if an image occupies 1/3 of the screen width, set the `'webMaxViewportWidth'` to 3x the image width.\n * The source with the largest `'webMaxViewportWidth'` is used even for larger viewports.\n *\n * If set to `'initial'`, the component will select the correct source during mount based on container size. Does not work with static rendering.\n *\n * If set to `'live'`, the component will select the correct source on every resize based on container size. Does not work with static rendering.\n *\n * @default 'static'\n * @platform web\n */\n responsivePolicy?: 'live' | 'initial' | 'static';\n\n /**\n * Changing this prop resets the image view content to blank or a placeholder before loading and rendering the final image.\n * This is especially useful for any kinds of recycling views like [FlashList](https://github.com/shopify/flash-list)\n * to prevent showing the previous source before the new one fully loads.\n * @default null\n * @platform android\n * @platform ios\n */\n recyclingKey?: string | null;\n\n /**\n * Determines if an image should automatically begin playing if it is an\n * animated image.\n * @default true\n * @platform ios\n */\n autoplay?: boolean;\n\n /**\n * Called when the image starts to load.\n */\n onLoadStart?: () => void;\n\n /**\n * Called when the image load completes successfully.\n */\n onLoad?: (event: ImageLoadEventData) => void;\n\n /**\n * Called when the image is loading. Can be called multiple times before the image has finished loading.\n * The event object provides details on how many bytes were loaded so far and what's the expected total size.\n */\n onProgress?: (event: ImageProgressEventData) => void;\n\n /**\n * Called on an image fetching error.\n */\n onError?: (event: ImageErrorEventData) => void;\n\n /**\n * Called when the image load either succeeds or fails.\n */\n onLoadEnd?: () => void;\n\n // DEPRECATED\n\n /**\n * @deprecated Provides compatibility for [`defaultSource` from React Native Image](https://reactnative.dev/docs/image#defaultsource).\n * Use [`placeholder`](#placeholder) prop instead.\n */\n defaultSource?: ImageSource | null;\n\n /**\n * @deprecated Provides compatibility for [`loadingIndicatorSource` from React Native Image](https://reactnative.dev/docs/image#loadingindicatorsource).\n * Use [`placeholder`](#placeholder) prop instead.\n */\n loadingIndicatorSource?: ImageSource | null;\n\n /**\n * @deprecated Provides compatibility for [`resizeMode` from React Native Image](https://reactnative.dev/docs/image#resizemode).\n * Note that `\"repeat\"` option is not supported at all.\n * Use the more powerful [`contentFit`](#contentfit) and [`contentPosition`](#contentposition) props instead.\n */\n resizeMode?: 'cover' | 'contain' | 'stretch' | 'repeat' | 'center';\n\n /**\n * @deprecated Provides compatibility for [`fadeDuration` from React Native Image](https://reactnative.dev/docs/image#fadeduration-android).\n * Instead use [`transition`](#transition) with the provided duration.\n */\n fadeDuration?: number;\n\n /**\n * Whether this View should be focusable with a non-touch input device and receive focus with a hardware keyboard.\n * @default false\n * @platform android\n */\n focusable?: boolean;\n\n /**\n * When true, indicates that the view is an accessibility element.\n * When a view is an accessibility element, it groups its children into a single selectable component.\n *\n * On Android, the `accessible` property will be translated into the native `isScreenReaderFocusable`,\n * so it's only affecting the screen readers behaviour.\n * @default false\n * @platform android\n * @platform ios\n */\n accessible?: boolean;\n\n /**\n * The text that's read by the screen reader when the user interacts with the image. Sets the the `alt` tag on web which is used for web crawlers and link traversal.\n * @default undefined\n */\n accessibilityLabel?: string;\n\n /**\n * The text that's read by the screen reader when the user interacts with the image. Sets the the `alt` tag on web which is used for web crawlers and link traversal. Is an alias for `accessibilityLabel`.\n *\n * @alias accessibilityLabel\n * @default undefined\n */\n alt?: string;\n\n /**\n * Enables Live Text interaction with the image. Check official [Apple documentation](https://developer.apple.com/documentation/visionkit/enabling_live_text_interactions_with_images) for more details.\n * @default false\n * @platform ios 16.0+\n */\n enableLiveTextInteraction?: boolean;\n\n /**\n * Whether the image should be downscaled to match the size of the view container.\n * Turning off this functionality could negatively impact the application's performance, particularly when working with large assets.\n * However, it would result in smoother image resizing, and end-users would always have access to the highest possible asset quality.\n *\n * Downscaling is never used when the `contentFit` prop is set to `none` or `fill`.\n * @default true\n */\n allowDownscaling?: boolean;\n}\n\n/**\n * It narrows down some props to types expected by the native/web side.\n * @hidden\n */\nexport interface ImageNativeProps extends ImageProps {\n style?: RNImageStyle;\n source?: ImageSource[];\n placeholder?: ImageSource[];\n contentPosition?: ImageContentPositionObject;\n transition?: ImageTransition | null;\n autoplay?: boolean;\n nativeViewRef?: React.RefObject<ExpoImage>;\n}\n\n/**\n * A value that represents the relative position of a single axis.\n *\n * If `number`, it is a distance in points (logical pixels) from the respective edge.\\\n * If `string`, it must be a percentage value where `'100%'` is the difference in size between the container and the image along the respective axis,\n * or `'center'` which is an alias for `'50%'` that is the default value. You can read more regarding percentages on the MDN docs for\n * [`background-position`](https://developer.mozilla.org/en-US/docs/Web/CSS/background-position#regarding_percentages) that describes this concept well.\n */\nexport type ImageContentPositionValue = number | string | `${number}%` | `${number}` | 'center';\n\n// eslint-disable\n// prettier-ignore\n/**\n * Specifies the position of the image inside its container. One value controls the x-axis and the second value controls the y-axis.\n *\n * Additionally, it supports stringified shorthand form that specifies the edges to which to align the image content:\\\n * `'center'`, `'top'`, `'right'`, `'bottom'`, `'left'`, `'top center'`, `'top right'`, `'top left'`, `'right center'`, `'right top'`,\n * `'right bottom'`, `'bottom center'`, `'bottom right'`, `'bottom left'`, `'left center'`, `'left top'`, `'left bottom'`.\\\n * If only one keyword is provided, then the other dimension is set to `'center'` (`'50%'`), so the image is placed in the middle of the specified edge.\\\n * As an example, `'top right'` is the same as `{ top: 0, right: 0 }` and `'bottom'` is the same as `{ bottom: 0, left: '50%' }`.\n */\nexport type ImageContentPosition =\n /**\n * An object that positions the image relatively to the top-right corner.\n */\n {\n top?: ImageContentPositionValue;\n right?: ImageContentPositionValue;\n } |\n /**\n * An object that positions the image relatively to the top-left corner.\n */\n {\n top?: ImageContentPositionValue;\n left?: ImageContentPositionValue;\n } |\n /**\n * An object that positions the image relatively to the bottom-right corner.\n */\n {\n bottom?: ImageContentPositionValue;\n right?: ImageContentPositionValue;\n } |\n /**\n * An object that positions the image relatively to the bottom-left corner.\n */\n {\n bottom?: ImageContentPositionValue;\n left?: ImageContentPositionValue;\n }\n | ImageContentPositionString;\n// eslint-enable\n\nexport interface ImageBackgroundProps extends Omit<ImageProps, 'style'> {\n /** The style of the image container */\n style?: StyleProp<ViewStyle> | undefined;\n /** Style object for the image */\n imageStyle?: StyleProp<RNImageStyle> | undefined;\n /** @hidden */\n children?: React.ReactNode | undefined;\n}\n\n/**\n * @hidden It's described as part of {@link ImageContentPosition}.\n */\nexport type ImageContentPositionString =\n | 'center'\n | 'top'\n | 'right'\n | 'bottom'\n | 'left'\n | 'top center'\n | 'top right'\n | 'top left'\n | 'right center'\n | 'right top'\n | 'right bottom'\n | 'bottom center'\n | 'bottom right'\n | 'bottom left'\n | 'left center'\n | 'left top'\n | 'left bottom';\n\ntype OnlyObject<T> = T extends object ? T : never;\n\n/**\n * @hidden It's a conditional type that matches only objects of {@link ImageContentPosition}.\n */\nexport type ImageContentPositionObject = OnlyObject<ImageContentPosition>;\n\n/**\n * An object that describes the smooth transition when switching the image source.\n */\nexport type ImageTransition = {\n /**\n * The duration of the transition in milliseconds.\n * @default 0\n */\n duration?: number;\n\n /**\n * Specifies the speed curve of the transition effect and how intermediate values are calculated.\n * @default 'ease-in-out'\n */\n timing?: 'ease-in-out' | 'ease-in' | 'ease-out' | 'linear';\n\n /**\n * An animation effect used for transition.\n * @default 'cross-dissolve'\n *\n * On Android, only `'cross-dissolve'` is supported.\n * On Web, `'curl-up'` and `'curl-down'` effects are not supported.\n */\n effect?:\n | 'cross-dissolve'\n | 'flip-from-top'\n | 'flip-from-right'\n | 'flip-from-bottom'\n | 'flip-from-left'\n | 'curl-up'\n | 'curl-down'\n | null;\n};\n\nexport type ImageLoadEventData = {\n cacheType: 'none' | 'disk' | 'memory';\n source: {\n url: string;\n width: number;\n height: number;\n mediaType: string | null;\n isAnimated?: boolean;\n };\n};\n\nexport type ImageProgressEventData = {\n loaded: number;\n total: number;\n};\n\nexport type ImageErrorEventData = {\n error: string;\n};\n"]}
|
|
1
|
+
{"version":3,"file":"Image.types.js","sourceRoot":"","sources":["../src/Image.types.ts"],"names":[],"mappings":"","sourcesContent":["import { ImageStyle as RNImageStyle, ViewProps, StyleProp, ViewStyle } from 'react-native';\n\nimport ExpoImage from './ExpoImage';\n\nexport type ImageSource = {\n /**\n * A string representing the resource identifier for the image,\n * which could be an http address, a local file path, or the name of a static image resource.\n */\n uri?: string;\n /**\n * An object representing the HTTP headers to send along with the request for a remote image.\n * On web requires the `Access-Control-Allow-Origin` header returned by the server to include the current domain.\n */\n headers?: Record<string, string>;\n /**\n * Can be specified if known at build time, in which case the value\n * will be used to set the default `<Image/>` component dimension\n */\n width?: number;\n /**\n * Can be specified if known at build time, in which case the value\n * will be used to set the default `<Image/>` component dimension\n */\n height?: number;\n\n /**\n * The blurhash string to use to generate the image. You can read more about the blurhash\n * on [`woltapp/blurhash`](https://github.com/woltapp/blurhash) repo. Ignored when `uri` is provided.\n * When using the blurhash, you should also provide `width` and `height` (higher values reduce performance),\n * otherwise their default value is `16`.\n */\n blurhash?: string;\n\n /**\n * The thumbhash string to use to generate the image placeholder. You can read more about thumbhash\n * on the [`thumbhash website`](https://evanw.github.io/thumbhash/). Ignored when `uri` is provided.\n */\n thumbhash?: string;\n\n /**\n * The cache key used to query and store this specific image.\n * If not provided, the `uri` is used also as the cache key.\n */\n cacheKey?: string;\n /**\n * The max width of the viewport for which this source should be selected.\n * Has no effect if `source` prop is not an array or has only 1 element.\n * Has no effect if `responsivePolicy` is not set to `static`.\n * Ignored if `blurhash` or `thumbhash` is provided (image hashes are never selected if passed in an array).\n * @platform web\n */\n webMaxViewportWidth?: number;\n /**\n * Whether the image is animated (an animated GIF or WebP for example).\n * @platform android\n * @platform ios\n */\n isAnimated?: boolean;\n};\n\n/**\n * @hidden\n */\nexport type ImageStyle = RNImageStyle;\n\n/**\n * Determines how the image should be resized to fit its container.\n * @hidden Described in the {@link ImageProps['contentFit']}\n */\nexport type ImageContentFit = 'cover' | 'contain' | 'fill' | 'none' | 'scale-down';\n\n/**\n * Some props are from React Native Image that Expo Image supports (more or less) for easier migration,\n * but all of them are deprecated and might be removed in the future.\n */\nexport interface ImageProps extends ViewProps {\n /** @hidden */\n style?: StyleProp<RNImageStyle>;\n\n /**\n * The image source, either a remote URL, a local file resource or a number that is the result of the `require()` function.\n * When provided as an array of sources, the source that fits best into the container size and is closest to the screen scale\n * will be chosen. In this case it is important to provide `width`, `height` and `scale` properties.\n */\n source?: ImageSource | string | number | ImageSource[] | string[] | null;\n\n /**\n * An image to display while loading the proper image and no image has been displayed yet or the source is unset.\n */\n placeholder?: ImageSource | string | number | ImageSource[] | string[] | null;\n\n /**\n * Determines how the image should be resized to fit its container. This property tells the image to fill the container\n * in a variety of ways; such as \"preserve that aspect ratio\" or \"stretch up and take up as much space as possible\".\n * It mirrors the CSS [`object-fit`](https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit) property.\n *\n * - `'cover'` - The image is sized to maintain its aspect ratio while filling the container box.\n * If the image's aspect ratio does not match the aspect ratio of its box, then the object will be clipped to fit.\n *\n * - `'contain'` - The image is scaled down or up to maintain its aspect ratio while fitting within the container box.\n *\n * - `'fill'` - The image is sized to entirely fill the container box. If necessary, the image will be stretched or squished to fit.\n *\n * - `'none'` - The image is not resized and is centered by default.\n * When specified, the exact position can be controlled with [`contentPosition`](#contentposition) prop.\n *\n * - `'scale-down'` - The image is sized as if `none` or `contain` were specified, whichever would result in a smaller concrete image size.\n *\n * @default 'cover'\n */\n contentFit?: ImageContentFit;\n\n /**\n * Determines how the placeholder should be resized to fit its container. Available resize modes are the same as for the [`contentFit`](#contentfit) prop.\n * @default 'scale-down'\n */\n placeholderContentFit?: ImageContentFit;\n\n /**\n * It is used together with [`contentFit`](#contentfit) to specify how the image should be positioned with x/y coordinates inside its own container.\n * An equivalent of the CSS [`object-position`](https://developer.mozilla.org/en-US/docs/Web/CSS/object-position) property.\n * @default 'center'\n */\n contentPosition?: ImageContentPosition;\n\n /**\n * Describes how the image view should transition the contents when switching the image source.\\\n * If provided as a number, it is the duration in milliseconds of the `'cross-dissolve'` effect.\n */\n transition?: ImageTransition | number | null;\n\n /**\n * The radius of the blur in points, `0` means no blur effect.\n * This effect is not applied to placeholders.\n * @default 0\n */\n blurRadius?: number;\n\n /**\n * A color used to tint template images (a bitmap image where only the opacity matters).\n * The color is applied to every non-transparent pixel, causing the image’s shape to adopt that color.\n * This effect is not applied to placeholders.\n * @default null\n */\n tintColor?: string | null;\n\n /**\n * Priorities for completing loads. If more than one load is queued at a time,\n * the load with the higher priority will be started first.\n * Priorities are considered best effort, there are no guarantees about the order in which loads will start or finish.\n * @default 'normal'\n */\n priority?: 'low' | 'normal' | 'high' | null;\n\n /**\n * Determines whether to cache the image and where: on the disk, in the memory or both.\n *\n * - `'none'` - Image is not cached at all.\n *\n * - `'disk'` - Image is queried from the disk cache if exists, otherwise it's downloaded and then stored on the disk.\n *\n * - `'memory'` - Image is cached in memory. Might be useful when you render a high-resolution picture many times.\n * Memory cache may be purged very quickly to prevent high memory usage and the risk of out of memory exceptions.\n *\n * - `'memory-disk'` - Image is cached in memory, but with a fallback to the disk cache.\n *\n * @default 'disk'\n */\n cachePolicy?: 'none' | 'disk' | 'memory' | 'memory-disk' | /** @hidden */ null;\n\n /**\n * Controls the selection of the image source based on the container or viewport size on the web.\n *\n * If set to `'static'`, the browser selects the correct source based on user's viewport width. Works with static rendering.\n * Make sure to set the `'webMaxViewportWidth'` property on each source for best results.\n * For example, if an image occupies 1/3 of the screen width, set the `'webMaxViewportWidth'` to 3x the image width.\n * The source with the largest `'webMaxViewportWidth'` is used even for larger viewports.\n *\n * If set to `'initial'`, the component will select the correct source during mount based on container size. Does not work with static rendering.\n *\n * If set to `'live'`, the component will select the correct source on every resize based on container size. Does not work with static rendering.\n *\n * @default 'static'\n * @platform web\n */\n responsivePolicy?: 'live' | 'initial' | 'static';\n\n /**\n * Changing this prop resets the image view content to blank or a placeholder before loading and rendering the final image.\n * This is especially useful for any kinds of recycling views like [FlashList](https://github.com/shopify/flash-list)\n * to prevent showing the previous source before the new one fully loads.\n * @default null\n * @platform android\n * @platform ios\n */\n recyclingKey?: string | null;\n\n /**\n * Determines if an image should automatically begin playing if it is an\n * animated image.\n * @default true\n * @platform ios\n */\n autoplay?: boolean;\n\n /**\n * Called when the image starts to load.\n */\n onLoadStart?: () => void;\n\n /**\n * Called when the image load completes successfully.\n */\n onLoad?: (event: ImageLoadEventData) => void;\n\n /**\n * Called when the image is loading. Can be called multiple times before the image has finished loading.\n * The event object provides details on how many bytes were loaded so far and what's the expected total size.\n */\n onProgress?: (event: ImageProgressEventData) => void;\n\n /**\n * Called on an image fetching error.\n */\n onError?: (event: ImageErrorEventData) => void;\n\n /**\n * Called when the image load either succeeds or fails.\n */\n onLoadEnd?: () => void;\n\n // DEPRECATED\n\n /**\n * @deprecated Provides compatibility for [`defaultSource` from React Native Image](https://reactnative.dev/docs/image#defaultsource).\n * Use [`placeholder`](#placeholder) prop instead.\n */\n defaultSource?: ImageSource | null;\n\n /**\n * @deprecated Provides compatibility for [`loadingIndicatorSource` from React Native Image](https://reactnative.dev/docs/image#loadingindicatorsource).\n * Use [`placeholder`](#placeholder) prop instead.\n */\n loadingIndicatorSource?: ImageSource | null;\n\n /**\n * @deprecated Provides compatibility for [`resizeMode` from React Native Image](https://reactnative.dev/docs/image#resizemode).\n * Note that `\"repeat\"` option is not supported at all.\n * Use the more powerful [`contentFit`](#contentfit) and [`contentPosition`](#contentposition) props instead.\n */\n resizeMode?: 'cover' | 'contain' | 'stretch' | 'repeat' | 'center';\n\n /**\n * @deprecated Provides compatibility for [`fadeDuration` from React Native Image](https://reactnative.dev/docs/image#fadeduration-android).\n * Instead use [`transition`](#transition) with the provided duration.\n */\n fadeDuration?: number;\n\n /**\n * Whether this View should be focusable with a non-touch input device and receive focus with a hardware keyboard.\n * @default false\n * @platform android\n */\n focusable?: boolean;\n\n /**\n * When true, indicates that the view is an accessibility element.\n * When a view is an accessibility element, it groups its children into a single selectable component.\n *\n * On Android, the `accessible` property will be translated into the native `isScreenReaderFocusable`,\n * so it's only affecting the screen readers behaviour.\n * @default false\n * @platform android\n * @platform ios\n */\n accessible?: boolean;\n\n /**\n * The text that's read by the screen reader when the user interacts with the image. Sets the the `alt` tag on web which is used for web crawlers and link traversal.\n * @default undefined\n */\n accessibilityLabel?: string;\n\n /**\n * The text that's read by the screen reader when the user interacts with the image. Sets the the `alt` tag on web which is used for web crawlers and link traversal. Is an alias for `accessibilityLabel`.\n *\n * @alias accessibilityLabel\n * @default undefined\n */\n alt?: string;\n\n /**\n * Enables Live Text interaction with the image. Check official [Apple documentation](https://developer.apple.com/documentation/visionkit/enabling_live_text_interactions_with_images) for more details.\n * @default false\n * @platform ios 16.0+\n */\n enableLiveTextInteraction?: boolean;\n\n /**\n * Whether the image should be downscaled to match the size of the view container.\n * Turning off this functionality could negatively impact the application's performance, particularly when working with large assets.\n * However, it would result in smoother image resizing, and end-users would always have access to the highest possible asset quality.\n *\n * Downscaling is never used when the `contentFit` prop is set to `none` or `fill`.\n * @default true\n */\n allowDownscaling?: boolean;\n}\n\n/**\n * It narrows down some props to types expected by the native/web side.\n * @hidden\n */\nexport interface ImageNativeProps extends ImageProps {\n style?: RNImageStyle;\n source?: ImageSource[];\n placeholder?: ImageSource[];\n contentPosition?: ImageContentPositionObject;\n transition?: ImageTransition | null;\n autoplay?: boolean;\n nativeViewRef?: React.RefObject<ExpoImage>;\n}\n\n/**\n * A value that represents the relative position of a single axis.\n *\n * If `number`, it is a distance in points (logical pixels) from the respective edge.\\\n * If `string`, it must be a percentage value where `'100%'` is the difference in size between the container and the image along the respective axis,\n * or `'center'` which is an alias for `'50%'` that is the default value. You can read more regarding percentages on the MDN docs for\n * [`background-position`](https://developer.mozilla.org/en-US/docs/Web/CSS/background-position#regarding_percentages) that describes this concept well.\n */\nexport type ImageContentPositionValue = number | string | `${number}%` | `${number}` | 'center';\n\n// eslint-disable\n// prettier-ignore\n/**\n * Specifies the position of the image inside its container. One value controls the x-axis and the second value controls the y-axis.\n *\n * Additionally, it supports stringified shorthand form that specifies the edges to which to align the image content:\\\n * `'center'`, `'top'`, `'right'`, `'bottom'`, `'left'`, `'top center'`, `'top right'`, `'top left'`, `'right center'`, `'right top'`,\n * `'right bottom'`, `'bottom center'`, `'bottom right'`, `'bottom left'`, `'left center'`, `'left top'`, `'left bottom'`.\\\n * If only one keyword is provided, then the other dimension is set to `'center'` (`'50%'`), so the image is placed in the middle of the specified edge.\\\n * As an example, `'top right'` is the same as `{ top: 0, right: 0 }` and `'bottom'` is the same as `{ bottom: 0, left: '50%' }`.\n */\nexport type ImageContentPosition =\n /**\n * An object that positions the image relatively to the top-right corner.\n */\n {\n top?: ImageContentPositionValue;\n right?: ImageContentPositionValue;\n } |\n /**\n * An object that positions the image relatively to the top-left corner.\n */\n {\n top?: ImageContentPositionValue;\n left?: ImageContentPositionValue;\n } |\n /**\n * An object that positions the image relatively to the bottom-right corner.\n */\n {\n bottom?: ImageContentPositionValue;\n right?: ImageContentPositionValue;\n } |\n /**\n * An object that positions the image relatively to the bottom-left corner.\n */\n {\n bottom?: ImageContentPositionValue;\n left?: ImageContentPositionValue;\n }\n | ImageContentPositionString;\n// eslint-enable\n\nexport interface ImageBackgroundProps extends Omit<ImageProps, 'style'> {\n /** The style of the image container */\n style?: StyleProp<ViewStyle> | undefined;\n /** Style object for the image */\n imageStyle?: StyleProp<RNImageStyle> | undefined;\n /** @hidden */\n children?: React.ReactNode | undefined;\n}\n\n/**\n * @hidden It's described as part of {@link ImageContentPosition}.\n */\nexport type ImageContentPositionString =\n | 'center'\n | 'top'\n | 'right'\n | 'bottom'\n | 'left'\n | 'top center'\n | 'top right'\n | 'top left'\n | 'right center'\n | 'right top'\n | 'right bottom'\n | 'bottom center'\n | 'bottom right'\n | 'bottom left'\n | 'left center'\n | 'left top'\n | 'left bottom';\n\ntype OnlyObject<T> = T extends object ? T : never;\n\n/**\n * @hidden It's a conditional type that matches only objects of {@link ImageContentPosition}.\n */\nexport type ImageContentPositionObject = OnlyObject<ImageContentPosition>;\n\n/**\n * An object that describes the smooth transition when switching the image source.\n */\nexport type ImageTransition = {\n /**\n * The duration of the transition in milliseconds.\n * @default 0\n */\n duration?: number;\n\n /**\n * Specifies the speed curve of the transition effect and how intermediate values are calculated.\n * @default 'ease-in-out'\n */\n timing?: 'ease-in-out' | 'ease-in' | 'ease-out' | 'linear';\n\n /**\n * An animation effect used for transition.\n * @default 'cross-dissolve'\n *\n * On Android, only `'cross-dissolve'` is supported.\n * On Web, `'curl-up'` and `'curl-down'` effects are not supported.\n */\n effect?:\n | 'cross-dissolve'\n | 'flip-from-top'\n | 'flip-from-right'\n | 'flip-from-bottom'\n | 'flip-from-left'\n | 'curl-up'\n | 'curl-down'\n | null;\n};\n\nexport type ImageLoadEventData = {\n cacheType: 'none' | 'disk' | 'memory';\n source: {\n url: string;\n width: number;\n height: number;\n mediaType: string | null;\n isAnimated?: boolean;\n };\n};\n\nexport type ImageProgressEventData = {\n loaded: number;\n total: number;\n};\n\nexport type ImageErrorEventData = {\n error: string;\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AssetSourceResolver.web.d.ts","sourceRoot":"","sources":["../../src/utils/AssetSourceResolver.web.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AssetSourceResolver.web.d.ts","sourceRoot":"","sources":["../../src/utils/AssetSourceResolver.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AAIvE,MAAM,MAAM,mBAAmB,GAAG;IAChC,gBAAgB,EAAE,OAAO,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAcF,MAAM,CAAC,OAAO,OAAO,mBAAmB;IACtC,SAAS,EAAE,MAAM,CAAC;IAGlB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE5B,KAAK,EAAE,aAAa,CAAC;gBAGnB,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,EACpC,WAAW,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,EACtC,KAAK,EAAE,aAAa;IAQtB,kBAAkB,IAAI,OAAO;IAK7B,sBAAsB,IAAI,OAAO;IAIjC,YAAY,IAAI,mBAAmB;IAInC;;OAEG;IACH,cAAc,IAAI,mBAAmB;IAUrC,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,mBAAmB;IAU/C,MAAM,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM;CAQhE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AssetSourceResolver.web.js","sourceRoot":"","sources":["../../src/utils/AssetSourceResolver.web.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AssetSourceResolver.web.js","sourceRoot":"","sources":["../../src/utils/AssetSourceResolver.web.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAU1C,wDAAwD;AACxD,SAAS,kBAAkB,CAAC,KAAK;IAC/B,MAAM,KAAK,GAAG,mBAAmB,CAAC,SAAS,CAAC,KAAK,CAAC,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AC,SAAS,CAAC,CAAC;QACxE,OAAO,CAAC,YAAY,CAAC,GAAG,CAAC,UAAU,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC;QAClD,OAAO,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAClD,OAAO,IAAI,CAAC,UAAU;QACpB,kBAAkB;QAClB,OAAO,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAC/C,CAAC;IACJ,CAAC;IAED,UAAU,CAAC,MAAc;QACvB,OAAO;YACL,gBAAgB,EAAE,IAAI;YACtB,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,IAAI,SAAS;YACpC,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,IAAI,SAAS;YACtC,GAAG,EAAE,MAAM;YACX,KAAK,EAAE,mBAAmB,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,UAAU,CAAC,GAAG,EAAE,CAAC;SAC1E,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,SAAS,CAAC,MAAgB,EAAE,WAAmB;QACpD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACtC,IAAI,MAAM,CAAC,CAAC,CAAC,IAAI,WAAW,EAAE;gBAC5B,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC;aAClB;SACF;QACD,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC;IACxC,CAAC;CACF","sourcesContent":["import { PackagerAsset } from '@react-native/assets-registry/registry';\nimport { Platform } from 'expo-modules-core';\nimport { PixelRatio } from 'react-native';\n\nexport type ResolvedAssetSource = {\n __packager_asset: boolean;\n width?: number;\n height?: number;\n uri: string;\n scale: number;\n};\n\n// Returns the Metro dev server-specific asset location.\nfunction getScaledAssetPath(asset): string {\n const scale = AssetSourceResolver.pickScale(asset.scales, PixelRatio.get());\n const scaleSuffix = scale === 1 ? '' : '@' + scale + 'x';\n const type = !asset.type ? '' : `.${asset.type}`;\n if (__DEV__) {\n return asset.httpServerLocation + '/' + asset.name + scaleSuffix + type;\n } else {\n return asset.httpServerLocation.replace(/\\.\\.\\//g, '_') + '/' + asset.name + scaleSuffix + type;\n }\n}\n\nexport default class AssetSourceResolver {\n serverUrl: string;\n // where the jsbundle is being run from\n // NOTE(EvanBacon): Never defined on web.\n jsbundleUrl?: string | null;\n // the asset to resolve\n asset: PackagerAsset;\n\n constructor(\n serverUrl: string | undefined | null,\n jsbundleUrl: string | undefined | null,\n asset: PackagerAsset\n ) {\n this.serverUrl = serverUrl || 'https://expo.dev';\n this.jsbundleUrl = null;\n this.asset = asset;\n }\n\n // Always true for web runtimes\n isLoadedFromServer(): boolean {\n return true;\n }\n\n // Always false for web runtimes\n isLoadedFromFileSystem(): boolean {\n return false;\n }\n\n defaultAsset(): ResolvedAssetSource {\n return this.assetServerURL();\n }\n\n /**\n * @returns absolute remote URL for the hosted asset.\n */\n assetServerURL(): ResolvedAssetSource {\n const fromUrl = new URL(getScaledAssetPath(this.asset), this.serverUrl);\n fromUrl.searchParams.set('platform', Platform.OS);\n fromUrl.searchParams.set('hash', this.asset.hash);\n return this.fromSource(\n // Relative on web\n fromUrl.toString().replace(fromUrl.origin, '')\n );\n }\n\n fromSource(source: string): ResolvedAssetSource {\n return {\n __packager_asset: true,\n width: this.asset.width ?? undefined,\n height: this.asset.height ?? undefined,\n uri: source,\n scale: AssetSourceResolver.pickScale(this.asset.scales, PixelRatio.get()),\n };\n }\n\n static pickScale(scales: number[], deviceScale: number): number {\n for (let i = 0; i < scales.length; i++) {\n if (scales[i] >= deviceScale) {\n return scales[i];\n }\n }\n return scales[scales.length - 1] || 1;\n }\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getAssetByID } from 'react-native/
|
|
1
|
+
import { getAssetByID } from '@react-native/assets-registry/registry';
|
|
2
2
|
import AssetSourceResolver from './AssetSourceResolver.web';
|
|
3
3
|
let _customSourceTransformer;
|
|
4
4
|
export function setCustomSourceTransformer(transformer) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveAssetSource.web.js","sourceRoot":"","sources":["../../src/utils/resolveAssetSource.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"resolveAssetSource.web.js","sourceRoot":"","sources":["../../src/utils/resolveAssetSource.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AAEtE,OAAO,mBAA4C,MAAM,2BAA2B,CAAC;AAErF,IAAI,wBAAwB,CAAC;AAE7B,MAAM,UAAU,0BAA0B,CACxC,WAAmE;IAEnE,wBAAwB,GAAG,WAAW,CAAC;AACzC,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,MAAW;IACpD,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;QAC9B,OAAO,MAAM,CAAC;KACf;IAED,MAAM,KAAK,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;IACnC,IAAI,CAAC,KAAK,EAAE;QACV,OAAO,SAAS,CAAC;KAClB;IAED,MAAM,QAAQ,GAAG,IAAI,mBAAmB,CAAC,kBAAkB,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;IAC1E,IAAI,wBAAwB,EAAE;QAC5B,OAAO,wBAAwB,CAAC,QAAQ,CAAC,CAAC;KAC3C;IACD,OAAO,QAAQ,CAAC,YAAY,EAAE,CAAC;AACjC,CAAC;AAED,MAAM,CAAC,cAAc,CAAC,kBAAkB,EAAE,4BAA4B,EAAE;IACtE,GAAG;QACD,OAAO,0BAA0B,CAAC;IACpC,CAAC;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,mBAAmB,CAAC","sourcesContent":["import { getAssetByID } from '@react-native/assets-registry/registry';\n\nimport AssetSourceResolver, { ResolvedAssetSource } from './AssetSourceResolver.web';\n\nlet _customSourceTransformer;\n\nexport function setCustomSourceTransformer(\n transformer: (resolver: AssetSourceResolver) => ResolvedAssetSource\n): void {\n _customSourceTransformer = transformer;\n}\n\n/**\n * `source` is either a number (opaque type returned by require('./foo.png'))\n * or an `ImageSource` like { uri: '<http location || file path>' }\n */\nexport default function resolveAssetSource(source: any): ResolvedAssetSource | undefined {\n if (typeof source === 'object') {\n return source;\n }\n\n const asset = getAssetByID(source);\n if (!asset) {\n return undefined;\n }\n\n const resolver = new AssetSourceResolver('https://expo.dev', null, asset);\n if (_customSourceTransformer) {\n return _customSourceTransformer(resolver);\n }\n return resolver.defaultAsset();\n}\n\nObject.defineProperty(resolveAssetSource, 'setCustomSourceTransformer', {\n get() {\n return setCustomSourceTransformer;\n },\n});\n\nexport const { pickScale } = AssetSourceResolver;\n"]}
|
package/ios/ExpoImage.podspec
CHANGED
|
@@ -10,7 +10,7 @@ Pod::Spec.new do |s|
|
|
|
10
10
|
s.license = package['license']
|
|
11
11
|
s.author = package['author']
|
|
12
12
|
s.homepage = package['homepage']
|
|
13
|
-
s.platforms = { :ios => '13.
|
|
13
|
+
s.platforms = { :ios => '13.4', :tvos => '13.4'}
|
|
14
14
|
s.swift_version = '5.4'
|
|
15
15
|
s.source = { git: 'https://github.com/expo/expo.git' }
|
|
16
16
|
s.static_framework = true
|
package/ios/ImageModule.swift
CHANGED
|
@@ -92,7 +92,7 @@ public final class ImageModule: Module {
|
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
Prop("autoplay") { (view, autoplay: Bool?) in
|
|
95
|
-
view.
|
|
95
|
+
view.autoplay = autoplay ?? true
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
AsyncFunction("startAnimating") { (view: ImageView) in
|
package/ios/ImageView.swift
CHANGED
|
@@ -53,6 +53,8 @@ public final class ImageView: ExpoView {
|
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
var autoplay: Bool = true
|
|
57
|
+
|
|
56
58
|
// MARK: - Events
|
|
57
59
|
|
|
58
60
|
let onLoadStart = EventDispatcher()
|
|
@@ -373,6 +375,12 @@ public final class ImageView: ExpoView {
|
|
|
373
375
|
private func setImage(_ image: UIImage?, contentFit: ContentFit, isPlaceholder: Bool) {
|
|
374
376
|
sdImageView.contentMode = contentFit.toContentMode()
|
|
375
377
|
|
|
378
|
+
if isPlaceholder {
|
|
379
|
+
sdImageView.autoPlayAnimatedImage = true
|
|
380
|
+
} else {
|
|
381
|
+
sdImageView.autoPlayAnimatedImage = autoplay
|
|
382
|
+
}
|
|
383
|
+
|
|
376
384
|
if let imageTintColor, !isPlaceholder {
|
|
377
385
|
sdImageView.tintColor = imageTintColor
|
|
378
386
|
sdImageView.image = image?.withRenderingMode(.alwaysTemplate)
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-image",
|
|
3
3
|
"title": "Expo Image",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.9.0",
|
|
5
5
|
"description": "A cross-platform, performant image component for React Native and Expo with Web support",
|
|
6
6
|
"main": "build/index.js",
|
|
7
7
|
"types": "build/index.d.ts",
|
|
@@ -26,12 +26,14 @@
|
|
|
26
26
|
],
|
|
27
27
|
"author": "650 Industries, Inc.",
|
|
28
28
|
"license": "MIT",
|
|
29
|
-
"dependencies": {
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"@react-native/assets-registry": "~0.72.0"
|
|
31
|
+
},
|
|
30
32
|
"devDependencies": {
|
|
31
33
|
"expo-module-scripts": "^3.0.0"
|
|
32
34
|
},
|
|
33
35
|
"peerDependencies": {
|
|
34
36
|
"expo": "*"
|
|
35
37
|
},
|
|
36
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "3142a086578deffd8704a8f1b6f0f661527d836c"
|
|
37
39
|
}
|
package/src/Image.tsx
CHANGED
|
@@ -74,6 +74,7 @@ export class Image extends React.PureComponent<ImageProps> {
|
|
|
74
74
|
|
|
75
75
|
/**
|
|
76
76
|
* Asynchronously starts playback of the view's image if it is animated.
|
|
77
|
+
* @platform android
|
|
77
78
|
* @platform ios
|
|
78
79
|
*/
|
|
79
80
|
async startAnimating(): Promise<void> {
|
|
@@ -82,6 +83,7 @@ export class Image extends React.PureComponent<ImageProps> {
|
|
|
82
83
|
|
|
83
84
|
/**
|
|
84
85
|
* Asynchronously stops the playback of the view's image if it is animated.
|
|
86
|
+
* @platform android
|
|
85
87
|
* @platform ios
|
|
86
88
|
*/
|
|
87
89
|
async stopAnimating(): Promise<void> {
|
|
@@ -122,6 +124,7 @@ export class Image extends React.PureComponent<ImageProps> {
|
|
|
122
124
|
contentFit={resolveContentFit(contentFit, resizeMode)}
|
|
123
125
|
contentPosition={resolveContentPosition(contentPosition)}
|
|
124
126
|
transition={resolveTransition(transition, fadeDuration)}
|
|
127
|
+
nativeViewRef={this.nativeViewRef}
|
|
125
128
|
/>
|
|
126
129
|
);
|
|
127
130
|
}
|
package/src/Image.types.ts
CHANGED
|
@@ -51,6 +51,12 @@ export type ImageSource = {
|
|
|
51
51
|
* @platform web
|
|
52
52
|
*/
|
|
53
53
|
webMaxViewportWidth?: number;
|
|
54
|
+
/**
|
|
55
|
+
* Whether the image is animated (an animated GIF or WebP for example).
|
|
56
|
+
* @platform android
|
|
57
|
+
* @platform ios
|
|
58
|
+
*/
|
|
59
|
+
isAnimated?: boolean;
|
|
54
60
|
};
|
|
55
61
|
|
|
56
62
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { PackagerAsset } from '@react-native/assets-registry/registry';
|
|
1
2
|
import { Platform } from 'expo-modules-core';
|
|
2
3
|
import { PixelRatio } from 'react-native';
|
|
3
|
-
import { PackagerAsset } from 'react-native/Libraries/Image/AssetRegistry';
|
|
4
4
|
|
|
5
5
|
export type ResolvedAssetSource = {
|
|
6
6
|
__packager_asset: boolean;
|