expo-image 0.2.2 → 1.0.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (121) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +13 -15
  3. package/android/build.gradle +8 -3
  4. package/android/proguard-rules.pro +6 -1
  5. package/android/src/main/java/expo/modules/image/Exceptions.kt +9 -0
  6. package/android/src/main/java/expo/modules/image/ExpoImageAppGlideModule.kt +9 -1
  7. package/android/src/main/java/expo/modules/image/ExpoImageModule.kt +157 -41
  8. package/android/src/main/java/expo/modules/image/ExpoImageView.kt +287 -104
  9. package/android/src/main/java/expo/modules/image/GlideModel.kt +58 -0
  10. package/android/src/main/java/expo/modules/image/ImageUtils.kt +37 -21
  11. package/android/src/main/java/expo/modules/image/ThumbnailRequestCoordinatorExtension.kt +18 -0
  12. package/android/src/main/java/expo/modules/image/ViewConnectedTarget.kt +170 -0
  13. package/android/src/main/java/expo/modules/image/YogaUtils.kt +0 -2
  14. package/android/src/main/java/expo/modules/image/blurhash/BlurHashFetcher.kt +32 -0
  15. package/android/src/main/java/expo/modules/image/blurhash/BlurhashDecoder.kt +189 -0
  16. package/android/src/main/java/expo/modules/image/blurhash/BlurhashModelLoader.kt +30 -0
  17. package/android/src/main/java/expo/modules/image/blurhash/BlurhashModelLoaderFactory.kt +14 -0
  18. package/android/src/main/java/expo/modules/image/blurhash/BlurhashModule.kt +17 -0
  19. package/android/src/main/java/expo/modules/image/dataurls/Base64DataFetcher.kt +27 -0
  20. package/android/src/main/java/expo/modules/image/dataurls/Base64ModelLoader.kt +24 -0
  21. package/android/src/main/java/expo/modules/image/dataurls/Base64ModelLoaderFactory.kt +12 -0
  22. package/android/src/main/java/expo/modules/image/{decoding/InputStreamBitmapOptionsDecoderGlideModule.kt → dataurls/Base64Module.kt} +5 -5
  23. package/android/src/main/java/expo/modules/image/drawing/OutlineProvider.kt +16 -14
  24. package/android/src/main/java/expo/modules/image/enums/ContentFit.kt +69 -0
  25. package/android/src/main/java/expo/modules/image/enums/ImageCacheType.kt +5 -11
  26. package/android/src/main/java/expo/modules/image/enums/ImageResizeMode.kt +13 -11
  27. package/android/src/main/java/expo/modules/image/enums/Priority.kt +15 -0
  28. package/android/src/main/java/expo/modules/image/events/GlideRequestListener.kt +64 -0
  29. package/android/src/main/java/expo/modules/image/events/OkHttpProgressListener.kt +26 -0
  30. package/android/src/main/java/expo/modules/image/okhttp/ExpoImageOkHttpClientGlideModule.kt +2 -1
  31. package/android/src/main/java/expo/modules/image/okhttp/OkHttpClientProgressInterceptor.kt +9 -7
  32. package/android/src/main/java/expo/modules/image/records/CachePolicy.kt +10 -0
  33. package/android/src/main/java/expo/modules/image/records/ContentPosition.kt +89 -0
  34. package/android/src/main/java/expo/modules/image/records/SourceMap.kt +143 -0
  35. package/android/src/main/java/expo/modules/image/records/events.kt +25 -0
  36. package/android/src/main/java/expo/modules/image/svg/SVGDecoder.kt +2 -2
  37. package/build/ExpoImage.d.ts +12 -2
  38. package/build/ExpoImage.d.ts.map +1 -1
  39. package/build/ExpoImage.js +71 -53
  40. package/build/ExpoImage.js.map +1 -1
  41. package/build/ExpoImage.web.d.ts +2 -2
  42. package/build/ExpoImage.web.d.ts.map +1 -1
  43. package/build/ExpoImage.web.js +139 -5
  44. package/build/ExpoImage.web.js.map +1 -1
  45. package/build/Image.d.ts +16 -37
  46. package/build/Image.d.ts.map +1 -1
  47. package/build/Image.js +33 -38
  48. package/build/Image.js.map +1 -1
  49. package/build/Image.types.d.ts +265 -31
  50. package/build/Image.types.d.ts.map +1 -1
  51. package/build/Image.types.js +99 -4
  52. package/build/Image.types.js.map +1 -1
  53. package/build/index.d.ts +1 -2
  54. package/build/index.d.ts.map +1 -1
  55. package/build/index.js +1 -2
  56. package/build/index.js.map +1 -1
  57. package/build/utils/resolveAssetSource.d.ts +3 -0
  58. package/build/utils/resolveAssetSource.d.ts.map +1 -0
  59. package/build/utils/resolveAssetSource.js +3 -0
  60. package/build/utils/resolveAssetSource.js.map +1 -0
  61. package/build/utils/resolveAssetSource.web.d.ts +2 -0
  62. package/build/utils/resolveAssetSource.web.d.ts.map +1 -0
  63. package/build/utils/resolveAssetSource.web.js +5 -0
  64. package/build/utils/resolveAssetSource.web.js.map +1 -0
  65. package/build/utils/resolveSources.d.ts +6 -0
  66. package/build/utils/resolveSources.d.ts.map +1 -0
  67. package/build/utils/resolveSources.js +45 -0
  68. package/build/utils/resolveSources.js.map +1 -0
  69. package/build/utils.d.ts +17 -0
  70. package/build/utils.d.ts.map +1 -0
  71. package/build/utils.js +87 -0
  72. package/build/utils.js.map +1 -0
  73. package/expo-module.config.json +9 -0
  74. package/ios/Blurhash.swift +326 -0
  75. package/ios/BlurhashLoader.swift +57 -0
  76. package/ios/ContentFit.swift +55 -0
  77. package/ios/ContentPosition.swift +108 -0
  78. package/ios/ExpoImage.podspec +30 -0
  79. package/ios/ImageCachePolicy.swift +24 -0
  80. package/ios/ImageCacheType.swift +24 -0
  81. package/ios/ImageModule.swift +99 -0
  82. package/ios/ImagePriority.swift +22 -0
  83. package/ios/ImageSource.swift +28 -0
  84. package/ios/ImageTransition.swift +73 -0
  85. package/ios/ImageUtils.swift +175 -0
  86. package/ios/ImageView.swift +357 -0
  87. package/package.json +3 -3
  88. package/src/ExpoImage.tsx +104 -81
  89. package/src/ExpoImage.web.tsx +204 -6
  90. package/src/Image.tsx +51 -80
  91. package/src/Image.types.ts +307 -32
  92. package/src/index.ts +1 -2
  93. package/src/utils/resolveAssetSource.tsx +3 -0
  94. package/src/utils/resolveAssetSource.web.tsx +4 -0
  95. package/src/utils/resolveSources.tsx +50 -0
  96. package/src/utils.ts +111 -0
  97. package/tsconfig.json +1 -1
  98. package/EXImage.podspec +0 -43
  99. package/android/src/main/java/expo/modules/image/ExpoImagePackage.kt +0 -13
  100. package/android/src/main/java/expo/modules/image/ExpoImageViewManager.kt +0 -147
  101. package/android/src/main/java/expo/modules/image/decoding/InputStreamBitmapFactoryOptionsDecoder.kt +0 -20
  102. package/android/src/main/java/expo/modules/image/drawing/BorderDrawable.kt +0 -1072
  103. package/android/src/main/java/expo/modules/image/events/ImageErrorEvent.kt +0 -56
  104. package/android/src/main/java/expo/modules/image/events/ImageLoadEvent.kt +0 -34
  105. package/android/src/main/java/expo/modules/image/events/ImageLoadEventsManager.kt +0 -57
  106. package/android/src/main/java/expo/modules/image/events/ImageLoadStartEvent.kt +0 -17
  107. package/android/src/main/java/expo/modules/image/events/ImageProgressEvent.kt +0 -21
  108. package/ios/AutolinkingPlaceholder.xcodeproj +0 -0
  109. package/ios/EXImageBorders.h +0 -49
  110. package/ios/EXImageBorders.m +0 -368
  111. package/ios/EXImageCornerRadii.h +0 -32
  112. package/ios/EXImageCornerRadii.m +0 -159
  113. package/ios/EXImageCustomCoders.h +0 -12
  114. package/ios/EXImageCustomCoders.m +0 -57
  115. package/ios/EXImageTypes.h +0 -20
  116. package/ios/EXImageTypes.m +0 -68
  117. package/ios/EXImageView.h +0 -79
  118. package/ios/EXImageView.m +0 -368
  119. package/ios/EXImageViewManager.h +0 -7
  120. package/ios/EXImageViewManager.m +0 -37
  121. package/react-native.config.js +0 -1
package/CHANGELOG.md ADDED
@@ -0,0 +1,17 @@
1
+ # Changelog
2
+
3
+ ## Unpublished
4
+
5
+ ### 🛠 Breaking changes
6
+
7
+ ### 🎉 New features
8
+
9
+ ### 🐛 Bug fixes
10
+
11
+ ### 💡 Others
12
+
13
+ ## 1.0.0-alpha.1 — 2022-12-16
14
+
15
+ ### 🎉 New features
16
+
17
+ - Initial release 🥳
package/README.md CHANGED
@@ -1,32 +1,30 @@
1
1
  # expo-image
2
2
 
3
- A cross-platform, performant image component for React Native and Expo with Web support
3
+ > 🚨 This module is experimental, incomplete, and we advise against using it in production its current state.
4
+
5
+ A cross-platform, performant image component for React Native and Expo with Web support.
4
6
 
5
7
  # API documentation
6
8
 
7
- - [Documentation for the main branch](https://github.com/expo/expo/blob/main/docs/pages/versions/unversioned/sdk/image.md)
8
- - [Documentation for the latest stable release](https://docs.expo.dev/versions/latest/sdk/image/)
9
+ The documentation is not available yet, but most of the public APIs already have TSDoc comments.
9
10
 
10
11
  # Installation in managed Expo projects
11
12
 
12
- For [managed](https://docs.expo.dev/versions/latest/introduction/managed-vs-bare/) Expo projects, please follow the installation instructions in the [API documentation for the latest stable release](https://docs.expo.dev/versions/latest/sdk/image/). If you follow the link and there is no documentation available then this library is not yet usable within managed projects — it is likely to be included in an upcoming Expo SDK release.
13
+ `expo-image` is not available for managed workflow yet.
13
14
 
14
15
  # Installation in bare React Native projects
15
16
 
16
- ### Add the package to your npm dependencies
17
-
18
- ```
19
- npm install expo-image
20
- ```
17
+ For bare React Native projects, you must ensure that you have [installed and configured the `expo` package](https://docs.expo.dev/bare/installing-expo-modules/) before continuing.
21
18
 
22
- ### Configure for iOS
19
+ > 🚨 Expo Image is compatible only with Expo SDK47+
23
20
 
24
- Run `npx pod-install` after installing the npm package.
21
+ Add the package to your dependencies with the following commands:
25
22
 
26
- ### Configure for Android
27
-
28
- No additional setup necessary.
23
+ ```
24
+ expo install expo-camera
25
+ npx pod-install
26
+ ```
29
27
 
30
28
  # Contributing
31
29
 
32
- Contributions are very welcome! Please refer to guidelines described in the [contributing guide](https://github.com/expo/expo#contributing).
30
+ Contributions are not encouraged at this time.
@@ -55,7 +55,7 @@ android {
55
55
  minSdkVersion safeExtGet("minSdkVersion", 21)
56
56
  targetSdkVersion safeExtGet("targetSdkVersion", 31)
57
57
  versionCode 1
58
- versionName "0.2.2"
58
+ versionName "1.0.0-alpha.1"
59
59
  }
60
60
  lintOptions {
61
61
  abortOnError false
@@ -88,16 +88,21 @@ repositories {
88
88
  }
89
89
 
90
90
  dependencies {
91
- def GLIDE_VERSION = "4.12.0"
91
+ def GLIDE_VERSION = "4.13.2"
92
+
93
+ implementation project(':expo-modules-core')
92
94
 
93
95
  //noinspection GradleDynamicVersion
94
96
  implementation 'com.facebook.react:react-native:+' // From node_modules
95
97
 
96
- implementation "com.github.zjupure:webpdecoder:2.0.${GLIDE_VERSION}"
98
+ implementation "com.github.zjupure:webpdecoder:2.1.${GLIDE_VERSION}"
97
99
  api "com.github.bumptech.glide:glide:${GLIDE_VERSION}"
98
100
  kapt "com.github.bumptech.glide:compiler:${GLIDE_VERSION}"
99
101
  api 'com.caverock:androidsvg-aar:1.4'
100
102
 
103
+ implementation "com.github.penfeizhou.android.animation:glide-plugin:2.24.0"
104
+ implementation "com.github.bumptech.glide:avif-integration:${GLIDE_VERSION}"
105
+
101
106
  api 'com.github.bumptech.glide:okhttp3-integration:4.11.0'
102
107
  api "com.squareup.okhttp3:okhttp:${safeExtGet("okHttpVersion", '4.9.2')}"
103
108
 
@@ -1,5 +1,6 @@
1
1
  # https://bumptech.github.io/glide/doc/download-setup.html#proguard
2
2
 
3
+ -keep public class * implements com.bumptech.glide.module.LibraryGlideModule
3
4
  -keep public class * implements com.bumptech.glide.module.GlideModule
4
5
  -keep public class * extends com.bumptech.glide.module.AppGlideModule
5
6
  -keep public enum com.bumptech.glide.load.ImageHeaderParser$** {
@@ -17,4 +18,8 @@
17
18
 
18
19
  -keep public class com.bumptech.glide.integration.webp.WebpImage { *; }
19
20
  -keep public class com.bumptech.glide.integration.webp.WebpFrame { *; }
20
- -keep public class com.bumptech.glide.integration.webp.WebpBitmapFactory { *; }
21
+ -keep public class com.bumptech.glide.integration.webp.WebpBitmapFactory { *; }
22
+
23
+ -keep public class com.bumptech.glide.requestThumbnailRequestCoordinator {
24
+ *;
25
+ }
@@ -0,0 +1,9 @@
1
+ package expo.modules.image
2
+
3
+ import expo.modules.kotlin.exception.CodedException
4
+
5
+ class ImagePrefetchFailure(message: String) :
6
+ CodedException(message = "Failed to prefetch the image: $message")
7
+
8
+ class MissingActivity :
9
+ CodedException(message = "The current activity is no longer available")
@@ -1,5 +1,8 @@
1
1
  package expo.modules.image
2
2
 
3
+ import android.content.Context
4
+ import android.util.Log
5
+ import com.bumptech.glide.GlideBuilder
3
6
  import com.bumptech.glide.annotation.GlideModule
4
7
  import com.bumptech.glide.module.AppGlideModule
5
8
 
@@ -8,4 +11,9 @@ import com.bumptech.glide.module.AppGlideModule
8
11
  * to work.
9
12
  */
10
13
  @GlideModule
11
- class ExpoImageAppGlideModule : AppGlideModule()
14
+ class ExpoImageAppGlideModule : AppGlideModule() {
15
+ override fun applyOptions(context: Context, builder: GlideBuilder) {
16
+ super.applyOptions(context, builder)
17
+ builder.setLogLevel(Log.ERROR)
18
+ }
19
+ }
@@ -1,52 +1,168 @@
1
1
  package expo.modules.image
2
2
 
3
- import android.util.Log
3
+ import android.view.View
4
4
  import com.bumptech.glide.Glide
5
5
  import com.bumptech.glide.load.model.GlideUrl
6
- import com.facebook.react.bridge.Promise
7
- import com.facebook.react.bridge.ReactApplicationContext
8
- import com.facebook.react.bridge.ReactContextBaseJavaModule
9
- import com.facebook.react.bridge.ReactMethod
10
- import kotlinx.coroutines.CoroutineScope
11
- import kotlinx.coroutines.Dispatchers
12
- import kotlinx.coroutines.cancel
13
- import kotlinx.coroutines.launch
14
- import java.lang.Exception
15
- import java.lang.IllegalStateException
16
- import java.util.concurrent.CancellationException
17
-
18
- class ExpoImageModule(val context: ReactApplicationContext) : ReactContextBaseJavaModule(context) {
19
- private val moduleCoroutineScope = CoroutineScope(Dispatchers.IO)
20
- override fun getName() = "ExpoImageModule"
21
-
22
- @ReactMethod
23
- fun prefetch(url: String, promise: Promise) {
24
- moduleCoroutineScope.launch {
25
- try {
26
- val glideUrl = GlideUrl(url)
27
- val result = Glide.with(context)
28
- .download(glideUrl)
29
- .submit()
30
- .awaitGet()
31
- if (result != null) {
32
- promise.resolve(null)
33
- } else {
34
- promise.reject("ERR_IMAGE_PREFETCH_FAILURE", "Failed to prefetch the image: ${url}.")
35
- }
36
- } catch (e: Exception) {
37
- promise.reject("ERR_IMAGE_PREFETCH_FAILURE", "Failed to prefetch the image: ${e.message}", e)
6
+ import com.facebook.react.uimanager.PixelUtil
7
+ import com.facebook.react.uimanager.Spacing
8
+ import com.facebook.react.uimanager.ViewProps
9
+ import com.facebook.yoga.YogaConstants
10
+ import expo.modules.image.enums.ContentFit
11
+ import expo.modules.image.enums.Priority
12
+ import expo.modules.image.records.CachePolicy
13
+ import expo.modules.image.records.ContentPosition
14
+ import expo.modules.image.records.SourceMap
15
+ import expo.modules.kotlin.functions.Queues
16
+ import expo.modules.kotlin.modules.Module
17
+ import expo.modules.kotlin.modules.ModuleDefinition
18
+ import expo.modules.kotlin.views.ViewDefinitionBuilder
19
+
20
+ class ExpoImageModule : Module() {
21
+ override fun definition() = ModuleDefinition {
22
+ Name("ExpoImage")
23
+
24
+ Function("prefetch") { urls: List<String> ->
25
+ val context = appContext.reactContext ?: return@Function
26
+ urls.forEach {
27
+ Glide
28
+ .with(context)
29
+ .download(GlideUrl(it))
30
+ .submit()
38
31
  }
39
32
  }
40
- }
41
33
 
42
- override fun onCatalystInstanceDestroy() {
43
- try {
44
- // TODO: Use [expo.modules.core.errors.ModuleDestroyedException] when migrated to Expo Module
45
- moduleCoroutineScope.cancel(CancellationException("ExpoImage module is destroyed. Cancelling all jobs."))
46
- } catch (e: IllegalStateException) {
47
- Log.w("ExpoImageModule", "No coroutines to cancel")
34
+ AsyncFunction("clearMemoryCache") {
35
+ val activity = appContext.currentActivity ?: return@AsyncFunction false
36
+ Glide.get(activity).clearMemory()
37
+ return@AsyncFunction true
38
+ }.runOnQueue(Queues.MAIN)
39
+
40
+ AsyncFunction("clearDiskCache") {
41
+ val activity = appContext.currentActivity ?: return@AsyncFunction false
42
+ activity.let {
43
+ Glide.get(activity).clearDiskCache()
44
+ }
45
+
46
+ return@AsyncFunction true
47
+ }
48
+
49
+ View(ExpoImageViewWrapper::class) {
50
+ Events(
51
+ "onLoadStart",
52
+ "onProgress",
53
+ "onError",
54
+ "onLoad"
55
+ )
56
+
57
+ Prop("source") { view: ExpoImageViewWrapper, sources: List<SourceMap>? ->
58
+ view.imageView.sources = sources ?: emptyList()
59
+ }
60
+
61
+ Prop("contentFit") { view: ExpoImageViewWrapper, contentFit: ContentFit? ->
62
+ view.imageView.contentFit = contentFit ?: ContentFit.Cover
63
+ }
64
+
65
+ Prop("contentPosition") { view: ExpoImageViewWrapper, contentPosition: ContentPosition? ->
66
+ view.imageView.contentPosition = contentPosition ?: ContentPosition.center
67
+ }
68
+
69
+ Prop("blurRadius") { view: ExpoImageViewWrapper, blurRadius: Int ->
70
+ view.imageView.blurRadius = blurRadius
71
+ }
72
+
73
+ Prop("fadeDuration") { view: ExpoImageViewWrapper, fadeDuration: Int ->
74
+ view.imageView.fadeDuration = fadeDuration
75
+ }
76
+
77
+ PropGroup(
78
+ ViewProps.BORDER_RADIUS to 0,
79
+ ViewProps.BORDER_TOP_LEFT_RADIUS to 1,
80
+ ViewProps.BORDER_TOP_RIGHT_RADIUS to 2,
81
+ ViewProps.BORDER_BOTTOM_RIGHT_RADIUS to 3,
82
+ ViewProps.BORDER_BOTTOM_LEFT_RADIUS to 4,
83
+ ViewProps.BORDER_TOP_START_RADIUS to 5,
84
+ ViewProps.BORDER_TOP_END_RADIUS to 6,
85
+ ViewProps.BORDER_BOTTOM_START_RADIUS to 7,
86
+ ViewProps.BORDER_BOTTOM_END_RADIUS to 8
87
+ ) { view: ExpoImageViewWrapper, index: Int, borderRadius: Float? ->
88
+ val radius = makeYogaUndefinedIfNegative(borderRadius ?: YogaConstants.UNDEFINED)
89
+ view.imageView.setBorderRadius(index, radius)
90
+ }
91
+
92
+ PropGroup(
93
+ ViewProps.BORDER_WIDTH to Spacing.ALL,
94
+ ViewProps.BORDER_LEFT_WIDTH to Spacing.LEFT,
95
+ ViewProps.BORDER_RIGHT_WIDTH to Spacing.RIGHT,
96
+ ViewProps.BORDER_TOP_WIDTH to Spacing.TOP,
97
+ ViewProps.BORDER_BOTTOM_WIDTH to Spacing.BOTTOM,
98
+ ViewProps.BORDER_START_WIDTH to Spacing.START,
99
+ ViewProps.BORDER_END_WIDTH to Spacing.END
100
+ ) { view: ExpoImageViewWrapper, index: Int, width: Float? ->
101
+ val pixelWidth = makeYogaUndefinedIfNegative(width ?: YogaConstants.UNDEFINED)
102
+ .ifYogaDefinedUse(PixelUtil::toPixelFromDIP)
103
+ view.imageView.setBorderWidth(index, pixelWidth)
104
+ }
105
+
106
+ PropGroup(
107
+ ViewProps.BORDER_COLOR to Spacing.ALL,
108
+ ViewProps.BORDER_LEFT_COLOR to Spacing.LEFT,
109
+ ViewProps.BORDER_RIGHT_COLOR to Spacing.RIGHT,
110
+ ViewProps.BORDER_TOP_COLOR to Spacing.TOP,
111
+ ViewProps.BORDER_BOTTOM_COLOR to Spacing.BOTTOM,
112
+ ViewProps.BORDER_START_COLOR to Spacing.START,
113
+ ViewProps.BORDER_END_COLOR to Spacing.END
114
+ ) { view: ExpoImageViewWrapper, index: Int, color: Int? ->
115
+ val rgbComponent = if (color == null) YogaConstants.UNDEFINED else (color and 0x00FFFFFF).toFloat()
116
+ val alphaComponent = if (color == null) YogaConstants.UNDEFINED else (color ushr 24).toFloat()
117
+ view.imageView.setBorderColor(index, rgbComponent, alphaComponent)
118
+ }
119
+
120
+ Prop("borderStyle") { view: ExpoImageViewWrapper, borderStyle: String? ->
121
+ view.imageView.setBorderStyle(borderStyle)
122
+ }
123
+
124
+ Prop("backgroundColor") { view: ExpoImageViewWrapper, color: Int? ->
125
+ view.imageView.setBackgroundColor(color)
126
+ }
127
+
128
+ Prop("tintColor") { view: ExpoImageViewWrapper, color: Int? ->
129
+ view.imageView.setTintColor(color)
130
+ }
131
+
132
+ Prop("placeholder") { view: ExpoImageViewWrapper, placeholder: List<SourceMap>? ->
133
+ view.imageView.placeholders = placeholder ?: emptyList()
134
+ }
135
+
136
+ Prop("accessible") { view: ExpoImageViewWrapper, accessible: Boolean ->
137
+ view.imageView.isFocusable = accessible
138
+ }
139
+
140
+ Prop("priority") { view: ExpoImageViewWrapper, priority: Priority? ->
141
+ view.imageView.priority = priority ?: Priority.NORMAL
142
+ }
143
+
144
+ Prop("cachePolicy") { view: ExpoImageViewWrapper, cachePolicy: CachePolicy? ->
145
+ view.imageView.cachePolicy = cachePolicy ?: CachePolicy.DISK
146
+ }
147
+
148
+ OnViewDidUpdateProps { view: ExpoImageViewWrapper ->
149
+ view.imageView.onAfterUpdateTransaction()
150
+ }
151
+
152
+ OnViewDestroys { view: ExpoImageViewWrapper ->
153
+ view.imageView.onDrop()
154
+ }
48
155
  }
156
+ }
157
+ }
49
158
 
50
- super.onCatalystInstanceDestroy()
159
+ // TODO(@lukmccall): Remove when the same functionality will be defined by the expo-modules-core in SDK 48
160
+ @Suppress("FunctionName")
161
+ private inline fun <reified T : View, reified PropType, reified CustomValueType> ViewDefinitionBuilder<T>.PropGroup(
162
+ vararg props: Pair<String, CustomValueType>,
163
+ noinline body: (view: T, value: CustomValueType, prop: PropType) -> Unit
164
+ ) {
165
+ for ((name, value) in props) {
166
+ Prop<T, PropType>(name) { view, prop -> body(view, value, prop) }
51
167
  }
52
168
  }