expo-image 1.5.2 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +35 -0
- package/android/build.gradle +27 -15
- package/android/src/main/java/expo/modules/image/records/SourceMap.kt +4 -2
- package/android/src/main/java/expo/modules/image/svg/SVGDecoder.kt +2 -7
- package/android/src/main/java/expo/modules/image/svg/SVGDrawableTranscoder.kt +16 -3
- package/android/src/main/java/expo/modules/image/svg/SVGModule.kt +1 -1
- package/build/ExpoImage.js +1 -1
- package/build/ExpoImage.js.map +1 -1
- package/build/ExpoImage.web.d.ts +1 -1
- package/build/ExpoImage.web.d.ts.map +1 -1
- package/build/ExpoImage.web.js +13 -10
- package/build/ExpoImage.web.js.map +1 -1
- package/build/Image.js +1 -1
- package/build/Image.js.map +1 -1
- package/build/Image.types.d.ts +2 -4
- package/build/Image.types.d.ts.map +1 -1
- package/build/Image.types.js.map +1 -1
- package/build/ImageBackground.js +4 -3
- package/build/ImageBackground.js.map +1 -1
- package/build/utils/blurhash/useBlurhash.d.ts +7 -1
- package/build/utils/blurhash/useBlurhash.d.ts.map +1 -1
- package/build/utils/blurhash/useBlurhash.js +34 -13
- package/build/utils/blurhash/useBlurhash.js.map +1 -1
- package/build/web/AnimationManager.js +7 -3
- package/build/web/AnimationManager.js.map +1 -1
- package/build/web/ColorTintFilter.js +8 -5
- package/build/web/ColorTintFilter.js.map +1 -1
- package/build/web/ImageWrapper.d.ts.map +1 -1
- package/build/web/ImageWrapper.js +20 -26
- package/build/web/ImageWrapper.js.map +1 -1
- package/build/web/ImageWrapper.types.d.ts +12 -7
- package/build/web/ImageWrapper.types.d.ts.map +1 -1
- package/build/web/ImageWrapper.types.js.map +1 -1
- package/build/web/getImageWrapperEventHandler.d.ts +1 -1
- package/build/web/getImageWrapperEventHandler.d.ts.map +1 -1
- package/build/web/getImageWrapperEventHandler.js +8 -1
- package/build/web/getImageWrapperEventHandler.js.map +1 -1
- package/build/web/hooks.d.ts +13 -0
- package/build/web/hooks.d.ts.map +1 -0
- package/build/web/hooks.js +58 -0
- package/build/web/hooks.js.map +1 -0
- package/build/web/useSourceSelection.d.ts.map +1 -1
- package/build/web/useSourceSelection.js +3 -0
- package/build/web/useSourceSelection.js.map +1 -1
- package/ios/ImageView.swift +4 -4
- package/package.json +2 -2
- package/src/ExpoImage.web.tsx +5 -3
- package/src/Image.types.ts +2 -4
- package/src/utils/blurhash/useBlurhash.tsx +42 -17
- package/src/web/ImageWrapper.tsx +11 -24
- package/src/web/ImageWrapper.types.ts +17 -5
- package/src/web/getImageWrapperEventHandler.ts +8 -1
- package/src/web/hooks.ts +72 -0
- package/src/web/useSourceSelection.ts +4 -0
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,41 @@
|
|
|
10
10
|
|
|
11
11
|
### 💡 Others
|
|
12
12
|
|
|
13
|
+
## 1.6.0 — 2023-10-17
|
|
14
|
+
|
|
15
|
+
### 🛠 Breaking changes
|
|
16
|
+
|
|
17
|
+
- Dropped support for Android SDK 21 and 22. ([#24201](https://github.com/expo/expo/pull/24201) by [@behenate](https://github.com/behenate))
|
|
18
|
+
|
|
19
|
+
### 🎉 New features
|
|
20
|
+
|
|
21
|
+
- Added support for the `headers` key in the `source` object on web. ([#24447](https://github.com/expo/expo/pull/24447) by [@aleqsio](https://github.com/aleqsio))
|
|
22
|
+
- Add support for setting `tintColor` on SVGs on Android (part 1) ([#24733](https://github.com/expo/expo/pull/24733) by [@alanjhughes](https://github.com/alanjhughes) and [@kadikraman](https://github.com/kadikraman))
|
|
23
|
+
- Add support for setting `tintColor` on SVGs on Android (part 2) ([#24888](https://github.com/expo/expo/pull/24888) by [@kadikraman](https://github.com/kadikraman))
|
|
24
|
+
|
|
25
|
+
### 🐛 Bug fixes
|
|
26
|
+
|
|
27
|
+
- Remove `GlideWebpDecoder` until they update their `libwebp` dependency. ([#24656](https://github.com/expo/expo/pull/24656) by [@alanjhughes](https://github.com/alanjhughes))
|
|
28
|
+
- [web] Fix content fit not being applied correctly when using hash placeholders. ([#24542](https://github.com/expo/expo/pull/24542) by [@aleqsio](https://github.com/aleqsio))
|
|
29
|
+
- [macCatalyst] Fix build with `ImageAnalyzer` on macCatalyst below 17.0. ([#24880](https://github.com/expo/expo/pull/24880) by [@kesha-antonov](https://github.com/kesha-antonov))
|
|
30
|
+
|
|
31
|
+
### 💡 Others
|
|
32
|
+
|
|
33
|
+
- Ship untranspiled JSX to support custom handling of `jsx` and `createElement`. ([#24889](https://github.com/expo/expo/pull/24889) by [@EvanBacon](https://github.com/EvanBacon))
|
|
34
|
+
- Make `placeholderContentFit` visible in the docs. ([#24801](https://github.com/expo/expo/pull/24801) by [@behenate](https://github.com/behenate))
|
|
35
|
+
|
|
36
|
+
## 1.0.2 — 2023-09-29
|
|
37
|
+
|
|
38
|
+
### 🐛 Bug fixes
|
|
39
|
+
|
|
40
|
+
- Remove `GlideWebpDecoder` until they update their `libwebp` dependency. ([#24656](https://github.com/expo/expo/pull/24656) by [@alanjhughes](https://github.com/alanjhughes))
|
|
41
|
+
|
|
42
|
+
## 1.3.4 — 2023-09-28
|
|
43
|
+
|
|
44
|
+
### 🐛 Bug fixes
|
|
45
|
+
|
|
46
|
+
- Remove `GlideWebpDecoder` until they update their `libwebp` dependency. ([#24656](https://github.com/expo/expo/pull/24656) by [@alanjhughes](https://github.com/alanjhughes))
|
|
47
|
+
|
|
13
48
|
## 1.5.2 — 2023-09-18
|
|
14
49
|
|
|
15
50
|
_This version does not introduce any user-facing changes._
|
package/android/build.gradle
CHANGED
|
@@ -3,13 +3,17 @@ apply plugin: 'kotlin-android'
|
|
|
3
3
|
apply plugin: 'maven-publish'
|
|
4
4
|
apply plugin: 'kotlin-kapt'
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
|
|
7
|
+
if (expoModulesCorePlugin.exists()) {
|
|
8
|
+
apply from: expoModulesCorePlugin
|
|
9
|
+
applyKotlinExpoModulesCorePlugin()
|
|
10
|
+
// Remove this check, but keep the contents after SDK49 support is dropped
|
|
11
|
+
if (safeExtGet("expoProvidesDefaultConfig", false)) {
|
|
12
|
+
useCoreDependencies()
|
|
11
13
|
}
|
|
14
|
+
}
|
|
12
15
|
|
|
16
|
+
buildscript {
|
|
13
17
|
// Simple helper that allows the root project to override versions declared by this library.
|
|
14
18
|
ext.safeExtGet = { prop, fallback ->
|
|
15
19
|
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
|
|
@@ -34,7 +38,19 @@ buildscript {
|
|
|
34
38
|
}
|
|
35
39
|
|
|
36
40
|
android {
|
|
37
|
-
|
|
41
|
+
// Remove this if and it's contents, when support for SDK49 is dropped
|
|
42
|
+
if (!safeExtGet("expoProvidesDefaultConfig", false)) {
|
|
43
|
+
compileSdkVersion safeExtGet("compileSdkVersion", 33)
|
|
44
|
+
|
|
45
|
+
defaultConfig {
|
|
46
|
+
minSdkVersion safeExtGet("minSdkVersion", 23)
|
|
47
|
+
targetSdkVersion safeExtGet("targetSdkVersion", 33)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
lintOptions {
|
|
51
|
+
abortOnError false
|
|
52
|
+
}
|
|
53
|
+
}
|
|
38
54
|
|
|
39
55
|
def agpVersion = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION
|
|
40
56
|
if (agpVersion.tokenize('.')[0].toInteger() < 8) {
|
|
@@ -50,15 +66,10 @@ android {
|
|
|
50
66
|
|
|
51
67
|
namespace "expo.modules.image"
|
|
52
68
|
defaultConfig {
|
|
53
|
-
minSdkVersion safeExtGet("minSdkVersion", 21)
|
|
54
|
-
targetSdkVersion safeExtGet("targetSdkVersion", 33)
|
|
55
69
|
versionCode 1
|
|
56
|
-
versionName "1.
|
|
70
|
+
versionName "1.6.0"
|
|
57
71
|
consumerProguardFiles("proguard-rules.pro")
|
|
58
72
|
}
|
|
59
|
-
lintOptions {
|
|
60
|
-
abortOnError false
|
|
61
|
-
}
|
|
62
73
|
publishing {
|
|
63
74
|
singleVariant("release") {
|
|
64
75
|
withSourcesJar()
|
|
@@ -90,12 +101,14 @@ repositories {
|
|
|
90
101
|
dependencies {
|
|
91
102
|
def GLIDE_VERSION = "4.13.2"
|
|
92
103
|
|
|
93
|
-
|
|
104
|
+
if (!safeExtGet("expoProvidesDefaultConfig", false)) {
|
|
105
|
+
implementation project(':expo-modules-core')
|
|
106
|
+
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${getKotlinVersion()}"
|
|
107
|
+
}
|
|
94
108
|
|
|
95
109
|
//noinspection GradleDynamicVersion
|
|
96
110
|
implementation 'com.facebook.react:react-native:+' // From node_modules
|
|
97
111
|
|
|
98
|
-
implementation "com.github.zjupure:webpdecoder:2.1.${GLIDE_VERSION}"
|
|
99
112
|
api "com.github.bumptech.glide:glide:${GLIDE_VERSION}"
|
|
100
113
|
kapt "com.github.bumptech.glide:compiler:${GLIDE_VERSION}"
|
|
101
114
|
api 'com.caverock:androidsvg-aar:1.4'
|
|
@@ -107,6 +120,5 @@ dependencies {
|
|
|
107
120
|
api "com.squareup.okhttp3:okhttp:${safeExtGet("okHttpVersion", '4.9.2')}"
|
|
108
121
|
|
|
109
122
|
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.1'
|
|
110
|
-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${getKotlinVersion()}"
|
|
111
123
|
implementation "jp.wasabeef:glide-transformations:4.3.0"
|
|
112
124
|
}
|
|
@@ -38,6 +38,8 @@ data class SourceMap(
|
|
|
38
38
|
|
|
39
39
|
private fun isLocalFileUri() = parsedUri?.scheme?.startsWith("file") ?: false
|
|
40
40
|
|
|
41
|
+
private fun isSvg() = parsedUri?.toString()?.substring(parsedUri.toString().lastIndexOf('.'))?.startsWith(".svg") ?: false
|
|
42
|
+
|
|
41
43
|
fun isBlurhash() = parsedUri?.scheme?.startsWith("blurhash") ?: false
|
|
42
44
|
|
|
43
45
|
fun isThumbhash() = parsedUri?.scheme?.startsWith("thumbhash") ?: false
|
|
@@ -100,9 +102,9 @@ data class SourceMap(
|
|
|
100
102
|
parsedUri = computeUri(context)
|
|
101
103
|
}
|
|
102
104
|
|
|
103
|
-
// Override the size for local assets. This ensures that
|
|
105
|
+
// Override the size for local assets (apart from SVGs). This ensures that
|
|
104
106
|
// resizeMode "center" displays the image in the correct size.
|
|
105
|
-
if (width != 0 && height != 0) {
|
|
107
|
+
if (width != 0 && height != 0 && !isSvg()) {
|
|
106
108
|
override((width * scale).toInt(), (height * scale).toInt())
|
|
107
109
|
}
|
|
108
110
|
|
|
@@ -4,7 +4,6 @@ import com.bumptech.glide.load.Options
|
|
|
4
4
|
import com.bumptech.glide.load.ResourceDecoder
|
|
5
5
|
import com.bumptech.glide.load.engine.Resource
|
|
6
6
|
import com.bumptech.glide.load.resource.SimpleResource
|
|
7
|
-
import com.bumptech.glide.request.target.Target.SIZE_ORIGINAL
|
|
8
7
|
import com.caverock.androidsvg.SVG
|
|
9
8
|
import com.caverock.androidsvg.SVGParseException
|
|
10
9
|
import java.io.IOException
|
|
@@ -24,12 +23,8 @@ class SVGDecoder : ResourceDecoder<InputStream, SVG> {
|
|
|
24
23
|
override fun decode(source: InputStream, width: Int, height: Int, options: Options): Resource<SVG>? {
|
|
25
24
|
return try {
|
|
26
25
|
val svg: SVG = SVG.getFromInputStream(source)
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
if (height != SIZE_ORIGINAL) {
|
|
31
|
-
svg.documentHeight = height.toFloat()
|
|
32
|
-
}
|
|
26
|
+
svg.documentWidth = width.toFloat()
|
|
27
|
+
svg.documentHeight = height.toFloat()
|
|
33
28
|
SimpleResource(svg)
|
|
34
29
|
} catch (ex: SVGParseException) {
|
|
35
30
|
throw IOException("Cannot load SVG from stream", ex)
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
package expo.modules.image.svg
|
|
2
2
|
|
|
3
|
+
import android.content.Context
|
|
4
|
+
import android.graphics.Bitmap
|
|
5
|
+
import android.graphics.Canvas
|
|
3
6
|
import android.graphics.Picture
|
|
7
|
+
import android.graphics.drawable.BitmapDrawable
|
|
4
8
|
import android.graphics.drawable.Drawable
|
|
5
9
|
import android.graphics.drawable.PictureDrawable
|
|
6
10
|
import com.bumptech.glide.load.Options
|
|
@@ -15,10 +19,19 @@ import com.caverock.androidsvg.SVG
|
|
|
15
19
|
* Copied from https://github.com/bumptech/glide/blob/10acc31a16b4c1b5684f69e8de3117371dfa77a8/samples/svg/src/main/java/com/bumptech/glide/samples/svg/SvgDrawableTranscoder.java
|
|
16
20
|
* and rewritten to Kotlin.
|
|
17
21
|
*/
|
|
18
|
-
class SVGDrawableTranscoder : ResourceTranscoder<SVG?, Drawable> {
|
|
22
|
+
class SVGDrawableTranscoder(val context: Context) : ResourceTranscoder<SVG?, Drawable> {
|
|
19
23
|
override fun transcode(toTranscode: Resource<SVG?>, options: Options): Resource<Drawable> {
|
|
20
24
|
val picture = toTranscode.get().renderToPicture()
|
|
21
|
-
val drawable
|
|
22
|
-
|
|
25
|
+
val drawable = PictureDrawable(picture)
|
|
26
|
+
val width = drawable.intrinsicWidth
|
|
27
|
+
val height = drawable.intrinsicHeight
|
|
28
|
+
|
|
29
|
+
val bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888)
|
|
30
|
+
val canvas = Canvas(bitmap)
|
|
31
|
+
drawable.setBounds(0, 0, canvas.width, canvas.height)
|
|
32
|
+
drawable.draw(canvas)
|
|
33
|
+
|
|
34
|
+
val newDrawable = BitmapDrawable(context.resources, bitmap)
|
|
35
|
+
return SimpleResource(newDrawable)
|
|
23
36
|
}
|
|
24
37
|
}
|
|
@@ -21,6 +21,6 @@ class SVGModule : LibraryGlideModule() {
|
|
|
21
21
|
super.registerComponents(context, glide, registry)
|
|
22
22
|
registry
|
|
23
23
|
.append(InputStream::class.java, SVG::class.java, SVGDecoder())
|
|
24
|
-
.register(SVG::class.java, Drawable::class.java, SVGDrawableTranscoder())
|
|
24
|
+
.register(SVG::class.java, Drawable::class.java, SVGDrawableTranscoder(context))
|
|
25
25
|
}
|
|
26
26
|
}
|
package/build/ExpoImage.js
CHANGED
|
@@ -67,7 +67,7 @@ class ExpoImage extends React.PureComponent {
|
|
|
67
67
|
const borderTopColor = processColor(resolvedStyle.borderTopColor);
|
|
68
68
|
// @ts-ignore
|
|
69
69
|
const borderBottomColor = processColor(resolvedStyle.borderBottomColor);
|
|
70
|
-
return (
|
|
70
|
+
return (<NativeExpoImage {...props} {...resolvedStyle} accessibilityLabel={accessibilityLabel ?? alt} style={resolvedStyle} onLoadStart={this.onLoadStart} onLoad={this.onLoad} onProgress={this.onProgress} onError={this.onError} tintColor={tintColor} borderColor={borderColor} borderLeftColor={borderLeftColor} borderRightColor={borderRightColor} borderTopColor={borderTopColor} borderBottomColor={borderBottomColor} borderStartColor={borderStartColor} borderEndColor={borderEndColor} backgroundColor={backgroundColor}/>);
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
export { ExpoImageModule };
|
package/build/ExpoImage.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoImage.js","sourceRoot":"","sources":["../src/ExpoImage.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAClF,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAwB,UAAU,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AASxF,MAAM,eAAe,GAAG,wBAAwB,CAAC,WAAW,CAAC,CAAC;AAE9D,MAAM,eAAe,GAAG,mBAAmB,CAAC,WAAW,CAAC,CAAC;AAEzD,SAAS,yBAAyB,CAChC,KAAwC;IAExC,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,WAAW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AAC,aAAa,CAAC,cAAc,CAAC,CAAC;QAClE,aAAa;QACb,MAAM,iBAAiB,GAAG,YAAY,CAAC,aAAa,CAAC,iBAAiB,CAAC,CAAC;QAExE,OAAO,CACL,CAAC,eAAe,CACd,IAAI,KAAK,CAAC,CACV,IAAI,aAAa,CAAC,CAClB,kBAAkB,CAAC,CAAC,kBAAkB,IAAI,GAAG,CAAC,CAC9C,KAAK,CAAC,CAAC,aAAa,CAAC,CACrB,WAAW,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAC9B,MAAM,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CACpB,UAAU,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAC5B,OAAO,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CACtB,SAAS,CAAC,CAAC,SAAS,CAAC,CACrB,WAAW,CAAC,CAAC,WAAW,CAAC,CACzB,eAAe,CAAC,CAAC,eAAe,CAAC,CACjC,gBAAgB,CAAC,CAAC,gBAAgB,CAAC,CACnC,cAAc,CAAC,CAAC,cAAc,CAAC,CAC/B,iBAAiB,CAAC,CAAC,iBAAiB,CAAC,CACrC,gBAAgB,CAAC,CAAC,gBAAgB,CAAC,CACnC,cAAc,CAAC,CAAC,cAAc,CAAC,CAC/B,eAAe,CAAC,CAAC,eAAe,CAAC,EACjC,CACH,CAAC;IACJ,CAAC;CACF;AAED,OAAO,EAAE,eAAe,EAAE,CAAC;AAC3B,eAAe,SAAS,CAAC","sourcesContent":["import { requireNativeViewManager, requireNativeModule } from 'expo-modules-core';\nimport React from 'react';\nimport { NativeSyntheticEvent, StyleSheet, Platform, processColor } from 'react-native';\n\nimport {\n ImageErrorEventData,\n ImageLoadEventData,\n ImageNativeProps,\n ImageProgressEventData,\n} from './Image.types';\n\nconst NativeExpoImage = requireNativeViewManager('ExpoImage');\n\nconst ExpoImageModule = requireNativeModule('ExpoImage');\n\nfunction withDeprecatedNativeEvent<NativeEvent>(\n event: NativeSyntheticEvent<NativeEvent>\n): NativeEvent {\n Object.defineProperty(event.nativeEvent, 'nativeEvent', {\n get() {\n console.warn(\n '[expo-image]: Accessing event payload through \"nativeEvent\" is deprecated, it is now part of the event object itself'\n );\n return event.nativeEvent;\n },\n });\n return event.nativeEvent;\n}\n\nclass ExpoImage extends React.PureComponent<ImageNativeProps> {\n onLoadStart = () => {\n this.props.onLoadStart?.();\n };\n\n onLoad = (event: NativeSyntheticEvent<ImageLoadEventData>) => {\n this.props.onLoad?.(withDeprecatedNativeEvent(event));\n this.onLoadEnd();\n };\n\n onProgress = (event: NativeSyntheticEvent<ImageProgressEventData>) => {\n this.props.onProgress?.(withDeprecatedNativeEvent(event));\n };\n\n onError = (event: NativeSyntheticEvent<ImageErrorEventData>) => {\n this.props.onError?.(withDeprecatedNativeEvent(event));\n this.onLoadEnd();\n };\n\n onLoadEnd = () => {\n this.props.onLoadEnd?.();\n };\n\n render() {\n const { style, accessibilityLabel, alt, ...props } = this.props;\n const resolvedStyle = StyleSheet.flatten(style);\n\n // Shadows behave different on iOS, Android & Web.\n // Android uses the `elevation` prop, whereas iOS\n // and web use the regular `shadow...` props.\n if (Platform.OS === 'android') {\n delete resolvedStyle.shadowColor;\n delete resolvedStyle.shadowOffset;\n delete resolvedStyle.shadowOpacity;\n delete resolvedStyle.shadowRadius;\n } else {\n // @ts-expect-error\n delete resolvedStyle.elevation;\n }\n\n // @ts-ignore\n const backgroundColor = processColor(resolvedStyle.backgroundColor);\n // On Android, we have to set the `backgroundColor` directly on the correct component.\n // So we have to remove it from styles. Otherwise, the background color won't take into consideration the border-radius.\n if (Platform.OS === 'android') {\n delete resolvedStyle.backgroundColor;\n }\n\n const tintColor = processColor(props.tintColor || resolvedStyle.tintColor);\n\n const borderColor = processColor(resolvedStyle.borderColor);\n // @ts-ignore\n const borderStartColor = processColor(resolvedStyle.borderStartColor);\n // @ts-ignore\n const borderEndColor = processColor(resolvedStyle.borderEndColor);\n // @ts-ignore\n const borderLeftColor = processColor(resolvedStyle.borderLeftColor);\n // @ts-ignore\n const borderRightColor = processColor(resolvedStyle.borderRightColor);\n // @ts-ignore\n const borderTopColor = processColor(resolvedStyle.borderTopColor);\n // @ts-ignore\n const borderBottomColor = processColor(resolvedStyle.borderBottomColor);\n\n return (\n <NativeExpoImage\n {...props}\n {...resolvedStyle}\n accessibilityLabel={accessibilityLabel ?? alt}\n style={resolvedStyle}\n onLoadStart={this.onLoadStart}\n onLoad={this.onLoad}\n onProgress={this.onProgress}\n onError={this.onError}\n tintColor={tintColor}\n borderColor={borderColor}\n borderLeftColor={borderLeftColor}\n borderRightColor={borderRightColor}\n borderTopColor={borderTopColor}\n borderBottomColor={borderBottomColor}\n borderStartColor={borderStartColor}\n borderEndColor={borderEndColor}\n backgroundColor={backgroundColor}\n />\n );\n }\n}\n\nexport { ExpoImageModule };\nexport default ExpoImage;\n"]}
|
package/build/ExpoImage.web.d.ts
CHANGED
|
@@ -4,5 +4,5 @@ export declare const ExpoImageModule: {
|
|
|
4
4
|
clearMemoryCache(): Promise<boolean>;
|
|
5
5
|
clearDiskCache(): Promise<boolean>;
|
|
6
6
|
};
|
|
7
|
-
export default function ExpoImage({ source, placeholder, contentFit, contentPosition, placeholderContentFit, onLoad, transition, onError, responsivePolicy, onLoadEnd, priority, blurRadius, recyclingKey, style, ...props }: ImageNativeProps): JSX.Element;
|
|
7
|
+
export default function ExpoImage({ source, placeholder, contentFit, contentPosition, placeholderContentFit, cachePolicy, onLoad, transition, onError, responsivePolicy, onLoadEnd, priority, blurRadius, recyclingKey, style, ...props }: ImageNativeProps): JSX.Element;
|
|
8
8
|
//# sourceMappingURL=ExpoImage.web.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoImage.web.d.ts","sourceRoot":"","sources":["../src/ExpoImage.web.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAmC,MAAM,eAAe,CAAC;AAQlF,eAAO,MAAM,eAAe;mBACX,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI;wBAQb,QAAQ,OAAO,CAAC;sBAIlB,QAAQ,OAAO,CAAC;CAGzC,CAAC;AA+BF,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,EAChC,MAAM,EACN,WAAW,EACX,UAAU,EACV,eAAe,EACf,qBAAqB,EACrB,MAAM,EACN,UAAU,EACV,OAAO,EACP,gBAAgB,EAChB,SAAS,EACT,QAAQ,EACR,UAAU,EACV,YAAY,EACZ,KAAK,EACL,GAAG,KAAK,EACT,EAAE,gBAAgB,
|
|
1
|
+
{"version":3,"file":"ExpoImage.web.d.ts","sourceRoot":"","sources":["../src/ExpoImage.web.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAmC,MAAM,eAAe,CAAC;AAQlF,eAAO,MAAM,eAAe;mBACX,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI;wBAQb,QAAQ,OAAO,CAAC;sBAIlB,QAAQ,OAAO,CAAC;CAGzC,CAAC;AA+BF,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,EAChC,MAAM,EACN,WAAW,EACX,UAAU,EACV,eAAe,EACf,qBAAqB,EACrB,WAAW,EACX,MAAM,EACN,UAAU,EACV,OAAO,EACP,gBAAgB,EAChB,SAAS,EACT,QAAQ,EACR,UAAU,EACV,YAAY,EACZ,KAAK,EACL,GAAG,KAAK,EACT,EAAE,gBAAgB,eA+ElB"}
|
package/build/ExpoImage.web.js
CHANGED
|
@@ -46,9 +46,9 @@ const setCssVariables = (element, size) => {
|
|
|
46
46
|
element?.style.setProperty('--expo-image-width', `${size.width}px`);
|
|
47
47
|
element?.style.setProperty('--expo-image-height', `${size.height}px`);
|
|
48
48
|
};
|
|
49
|
-
export default function ExpoImage({ source, placeholder, contentFit, contentPosition, placeholderContentFit, onLoad, transition, onError, responsivePolicy, onLoadEnd, priority, blurRadius, recyclingKey, style, ...props }) {
|
|
49
|
+
export default function ExpoImage({ source, placeholder, contentFit, contentPosition, placeholderContentFit, cachePolicy, onLoad, transition, onError, responsivePolicy, onLoadEnd, priority, blurRadius, recyclingKey, style, ...props }) {
|
|
50
50
|
const imagePlaceholderContentFit = placeholderContentFit || 'scale-down';
|
|
51
|
-
const
|
|
51
|
+
const imageHashStyle = {
|
|
52
52
|
objectFit: placeholderContentFit || contentFit,
|
|
53
53
|
};
|
|
54
54
|
const { containerRef, source: selectedSource } = useSourceSelection(source, responsivePolicy, setCssVariables);
|
|
@@ -56,13 +56,13 @@ export default function ExpoImage({ source, placeholder, contentFit, contentPosi
|
|
|
56
56
|
const initialNode = placeholder?.[0]?.uri
|
|
57
57
|
? [
|
|
58
58
|
initialNodeAnimationKey,
|
|
59
|
-
({ onAnimationFinished }) => (className, style) => (
|
|
59
|
+
({ onAnimationFinished }) => (className, style) => (<ImageWrapper {...props} source={placeholder?.[0]} style={{
|
|
60
60
|
objectFit: imagePlaceholderContentFit,
|
|
61
61
|
...(blurRadius ? { filter: `blur(${blurRadius}px)` } : {}),
|
|
62
62
|
...style,
|
|
63
|
-
}
|
|
63
|
+
}} className={className} events={{
|
|
64
64
|
onTransitionEnd: [onAnimationFinished],
|
|
65
|
-
}
|
|
65
|
+
}} contentPosition={{ left: '50%', top: '50%' }} hashPlaceholderContentPosition={contentPosition} hashPlaceholderStyle={imageHashStyle}/>),
|
|
66
66
|
]
|
|
67
67
|
: null;
|
|
68
68
|
const currentNodeAnimationKey = (recyclingKey
|
|
@@ -70,18 +70,21 @@ export default function ExpoImage({ source, placeholder, contentFit, contentPosi
|
|
|
70
70
|
: selectedSource?.uri ?? placeholder?.[0]?.uri) ?? '';
|
|
71
71
|
const currentNode = [
|
|
72
72
|
currentNodeAnimationKey,
|
|
73
|
-
({ onAnimationFinished, onReady, onMount, onError: onErrorInner }) => (className, style) => (
|
|
73
|
+
({ onAnimationFinished, onReady, onMount, onError: onErrorInner }) => (className, style) => (<ImageWrapper {...props} source={selectedSource || placeholder?.[0]} events={{
|
|
74
74
|
onError: [onErrorAdapter(onError), onLoadEnd, onErrorInner],
|
|
75
75
|
onLoad: [onLoadAdapter(onLoad), onLoadEnd, onReady],
|
|
76
76
|
onMount: [onMount],
|
|
77
77
|
onTransitionEnd: [onAnimationFinished],
|
|
78
|
-
}
|
|
78
|
+
}} style={{
|
|
79
79
|
objectFit: selectedSource ? contentFit : imagePlaceholderContentFit,
|
|
80
80
|
...(blurRadius ? { filter: `blur(${blurRadius}px)` } : {}),
|
|
81
81
|
...style,
|
|
82
|
-
}
|
|
82
|
+
}} className={className} cachePolicy={cachePolicy} priority={priority} contentPosition={selectedSource ? contentPosition : { top: '50%', left: '50%' }} hashPlaceholderContentPosition={contentPosition} hashPlaceholderStyle={imageHashStyle} accessibilityLabel={props.accessibilityLabel}/>),
|
|
83
83
|
];
|
|
84
|
-
return (
|
|
85
|
-
|
|
84
|
+
return (<View ref={containerRef} dataSet={{ expoimage: true }} style={[{ overflow: 'hidden' }, style]}>
|
|
85
|
+
<AnimationManager transition={transition} recyclingKey={recyclingKey} initial={initialNode}>
|
|
86
|
+
{currentNode}
|
|
87
|
+
</AnimationManager>
|
|
88
|
+
</View>);
|
|
86
89
|
}
|
|
87
90
|
//# sourceMappingURL=ExpoImage.web.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoImage.web.js","sourceRoot":"","sources":["../src/ExpoImage.web.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAGxC,OAAO,gBAA0C,MAAM,wBAAwB,CAAC;AAChF,OAAO,YAAY,MAAM,oBAAoB,CAAC;AAC9C,OAAO,SAAS,MAAM,mBAAmB,CAAC;AAC1C,OAAO,kBAAkB,MAAM,0BAA0B,CAAC;AAE1D,SAAS,EAAE,CAAC;AAEZ,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,QAAQ,CAAC,IAAuB;QAC9B,MAAM,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAA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B,CAAC,CAAC,KAAK,CAAC,kBAAkB,CAAC,EAC7C,CACH;KACJ,CAAC;IACF,OAAO,CACL,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,KAAK,CAAC,CAAC,CAC5F;MAAA,CAAC,gBAAgB,CAAC,UAAU,CAAC,CAAC,UAAU,CAAC,CAAC,YAAY,CAAC,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,CAAC,WAAW,CAAC,CACzF;QAAA,CAAC,WAAW,CACd;MAAA,EAAE,gBAAgB,CACpB;IAAA,EAAE,IAAI,CAAC,CACR,CAAC;AACJ,CAAC","sourcesContent":["import React from 'react';\nimport { View } from 'react-native-web';\n\nimport { ImageNativeProps, ImageSource, ImageLoadEventData } from './Image.types';\nimport AnimationManager, { AnimationManagerNode } from './web/AnimationManager';\nimport ImageWrapper from './web/ImageWrapper';\nimport loadStyle from './web/imageStyles';\nimport useSourceSelection from './web/useSourceSelection';\n\nloadStyle();\n\nexport const ExpoImageModule = {\n prefetch(urls: string | string[]): void {\n const urlsArray = Array.isArray(urls) ? urls : [urls];\n urlsArray.forEach((url) => {\n const img = new Image();\n img.src = url;\n });\n },\n\n async clearMemoryCache(): Promise<boolean> {\n return false;\n },\n\n async clearDiskCache(): Promise<boolean> {\n return false;\n },\n};\n\nfunction onLoadAdapter(onLoad?: (event: ImageLoadEventData) => void) {\n return (event: React.SyntheticEvent<HTMLImageElement, Event>) => {\n const target = event.target as HTMLImageElement;\n onLoad?.({\n source: {\n url: target.currentSrc,\n width: target.naturalWidth,\n height: target.naturalHeight,\n mediaType: null,\n },\n cacheType: 'none',\n });\n };\n}\n\nfunction onErrorAdapter(onError?: { (event: { error: string }): void }) {\n return ({ source }: { source?: ImageSource | null }) => {\n onError?.({\n error: `Failed to load image from url: ${source?.uri}`,\n });\n };\n}\n\n// Used for some transitions to mimic native animations\nconst setCssVariables = (element: HTMLElement, size: DOMRect) => {\n element?.style.setProperty('--expo-image-width', `${size.width}px`);\n element?.style.setProperty('--expo-image-height', `${size.height}px`);\n};\n\nexport default function ExpoImage({\n source,\n placeholder,\n contentFit,\n contentPosition,\n placeholderContentFit,\n cachePolicy,\n onLoad,\n transition,\n onError,\n responsivePolicy,\n onLoadEnd,\n priority,\n blurRadius,\n recyclingKey,\n style,\n ...props\n}: ImageNativeProps) {\n const imagePlaceholderContentFit = placeholderContentFit || 'scale-down';\n const imageHashStyle = {\n objectFit: placeholderContentFit || contentFit,\n };\n const { containerRef, source: selectedSource } = useSourceSelection(\n source,\n responsivePolicy,\n setCssVariables\n );\n\n const initialNodeAnimationKey =\n (recyclingKey ? `${recyclingKey}-${placeholder?.[0]?.uri}` : placeholder?.[0]?.uri) ?? '';\n\n const initialNode: AnimationManagerNode | null = placeholder?.[0]?.uri\n ? [\n initialNodeAnimationKey,\n ({ onAnimationFinished }) =>\n (className, style) => (\n <ImageWrapper\n {...props}\n source={placeholder?.[0]}\n style={{\n objectFit: imagePlaceholderContentFit,\n ...(blurRadius ? { filter: `blur(${blurRadius}px)` } : {}),\n ...style,\n }}\n className={className}\n events={{\n onTransitionEnd: [onAnimationFinished],\n }}\n contentPosition={{ left: '50%', top: '50%' }}\n hashPlaceholderContentPosition={contentPosition}\n hashPlaceholderStyle={imageHashStyle}\n />\n ),\n ]\n : null;\n\n const currentNodeAnimationKey =\n (recyclingKey\n ? `${recyclingKey}-${selectedSource?.uri ?? placeholder?.[0]?.uri}`\n : selectedSource?.uri ?? placeholder?.[0]?.uri) ?? '';\n\n const currentNode: AnimationManagerNode = [\n currentNodeAnimationKey,\n ({ onAnimationFinished, onReady, onMount, onError: onErrorInner }) =>\n (className, style) => (\n <ImageWrapper\n {...props}\n source={selectedSource || placeholder?.[0]}\n events={{\n onError: [onErrorAdapter(onError), onLoadEnd, onErrorInner],\n onLoad: [onLoadAdapter(onLoad), onLoadEnd, onReady],\n onMount: [onMount],\n onTransitionEnd: [onAnimationFinished],\n }}\n style={{\n objectFit: selectedSource ? contentFit : imagePlaceholderContentFit,\n ...(blurRadius ? { filter: `blur(${blurRadius}px)` } : {}),\n ...style,\n }}\n className={className}\n cachePolicy={cachePolicy}\n priority={priority}\n contentPosition={selectedSource ? contentPosition : { top: '50%', left: '50%' }}\n hashPlaceholderContentPosition={contentPosition}\n hashPlaceholderStyle={imageHashStyle}\n accessibilityLabel={props.accessibilityLabel}\n />\n ),\n ];\n return (\n <View ref={containerRef} dataSet={{ expoimage: true }} style={[{ overflow: 'hidden' }, style]}>\n <AnimationManager transition={transition} recyclingKey={recyclingKey} initial={initialNode}>\n {currentNode}\n </AnimationManager>\n </View>\n );\n}\n"]}
|
package/build/Image.js
CHANGED
|
@@ -43,7 +43,7 @@ export class Image extends React.PureComponent {
|
|
|
43
43
|
console.warn('[expo-image]: `defaultSource` and `loadingIndicatorSource` props are deprecated, use `placeholder` instead');
|
|
44
44
|
loggedDefaultSourceDeprecationWarning = true;
|
|
45
45
|
}
|
|
46
|
-
return (
|
|
46
|
+
return (<ExpoImage {...restProps} style={restStyle} source={resolveSources(source)} placeholder={resolveSources(placeholder ?? defaultSource ?? loadingIndicatorSource)} contentFit={resolveContentFit(contentFit, resizeMode)} contentPosition={resolveContentPosition(contentPosition)} transition={resolveTransition(transition, fadeDuration)}/>);
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
//# 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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,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,EACxD,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 /**\n * Preloads images at the given urls that can be later used in the image view.\n * Preloaded images are always cached on the disk, so make sure to use\n * `disk` (default) or `memory-disk` cache policy.\n */\n static prefetch(urls: string | string[]): void {\n return ExpoImageModule.prefetch(Array.isArray(urls) ? urls : [urls]);\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 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 />\n );\n }\n}\n"]}
|
package/build/Image.types.d.ts
CHANGED
|
@@ -7,8 +7,7 @@ export type ImageSource = {
|
|
|
7
7
|
uri?: string;
|
|
8
8
|
/**
|
|
9
9
|
* An object representing the HTTP headers to send along with the request for a remote image.
|
|
10
|
-
*
|
|
11
|
-
* @platform ios
|
|
10
|
+
* On web requires the `Access-Control-Allow-Origin` header returned by the server to include the current domain.
|
|
12
11
|
*/
|
|
13
12
|
headers?: Record<string, string>;
|
|
14
13
|
/**
|
|
@@ -94,8 +93,7 @@ export interface ImageProps extends ViewProps {
|
|
|
94
93
|
*/
|
|
95
94
|
contentFit?: ImageContentFit;
|
|
96
95
|
/**
|
|
97
|
-
* Determines how the placeholder should be resized to fit its container
|
|
98
|
-
* @hidden Described in the {@link ImageProps['contentFit']}
|
|
96
|
+
* Determines how the placeholder should be resized to fit its container. Available resize modes are the same as for the [`contentFit`](#contentfit) prop.
|
|
99
97
|
* @default 'scale-down'
|
|
100
98
|
*/
|
|
101
99
|
placeholderContentFit?: ImageContentFit;
|
|
@@ -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,MAAM,MAAM,WAAW,GAAG;IACxB;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb
|
|
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,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,CAAC;IACf;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;;;OAMG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B,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;;;GAGG;AACH,MAAM,WAAW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AM,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;KAC1B,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\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 * @platform android\n * @platform ios\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\n * @hidden Described in the {@link ImageProps['contentFit']}\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 * 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 * @platform android\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}\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 };\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\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 * 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 * @platform android\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}\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 };\n};\n\nexport type ImageProgressEventData = {\n loaded: number;\n total: number;\n};\n\nexport type ImageErrorEventData = {\n error: string;\n};\n"]}
|
package/build/ImageBackground.js
CHANGED
|
@@ -4,9 +4,10 @@ import { Image } from './Image';
|
|
|
4
4
|
export class ImageBackground extends React.PureComponent {
|
|
5
5
|
render() {
|
|
6
6
|
const { style, imageStyle, children, ...props } = this.props;
|
|
7
|
-
return (
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
return (<View style={style}>
|
|
8
|
+
<Image {...props} style={[StyleSheet.absoluteFill, imageStyle]}/>
|
|
9
|
+
{children}
|
|
10
|
+
</View>);
|
|
10
11
|
}
|
|
11
12
|
}
|
|
12
13
|
//# sourceMappingURL=ImageBackground.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImageBackground.js","sourceRoot":"","sources":["../src/ImageBackground.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAEhD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAGhC,MAAM,OAAO,eAAgB,SAAQ,KAAK,CAAC,aAAmC;IAC5E,MAAM;QACJ,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;QAE7D,OAAO,CACL,
|
|
1
|
+
{"version":3,"file":"ImageBackground.js","sourceRoot":"","sources":["../src/ImageBackground.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAEhD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAGhC,MAAM,OAAO,eAAgB,SAAQ,KAAK,CAAC,aAAmC;IAC5E,MAAM;QACJ,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;QAE7D,OAAO,CACL,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CACjB;QAAA,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC,EAC/D;QAAA,CAAC,QAAQ,CACX;MAAA,EAAE,IAAI,CAAC,CACR,CAAC;IACJ,CAAC;CACF","sourcesContent":["import React from 'react';\nimport { View, StyleSheet } from 'react-native';\n\nimport { Image } from './Image';\nimport { ImageBackgroundProps } from './Image.types';\n\nexport class ImageBackground extends React.PureComponent<ImageBackgroundProps> {\n render() {\n const { style, imageStyle, children, ...props } = this.props;\n\n return (\n <View style={style}>\n <Image {...props} style={[StyleSheet.absoluteFill, imageStyle]} />\n {children}\n </View>\n );\n }\n}\n"]}
|
|
@@ -1,2 +1,8 @@
|
|
|
1
|
-
export declare function useBlurhash(blurhash:
|
|
1
|
+
export declare function useBlurhash(blurhash: {
|
|
2
|
+
uri?: string;
|
|
3
|
+
width?: number;
|
|
4
|
+
height?: number;
|
|
5
|
+
} | undefined | null, punch?: number): {
|
|
6
|
+
uri: string;
|
|
7
|
+
} | null;
|
|
2
8
|
//# sourceMappingURL=useBlurhash.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useBlurhash.d.ts","sourceRoot":"","sources":["../../../src/utils/blurhash/useBlurhash.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useBlurhash.d.ts","sourceRoot":"","sources":["../../../src/utils/blurhash/useBlurhash.tsx"],"names":[],"mappings":"AAiBA,wBAAgB,WAAW,CACzB,QAAQ,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,GAAG,IAAI,EAC9E,KAAK,GAAE,MAAU;;SA6DlB"}
|