Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: expo-image #678

Merged
merged 1 commit into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"expo-clipboard": "~7.0.0",
"expo-crypto": "~14.0.1",
"expo-document-picker": "~13.0.1",
"expo-image": "~2.0.3",
"expo-image": "2.0.2",
"expo-image-picker": "~16.0.3",
"expo-keep-awake": "~14.0.1",
"expo-secure-store": "~14.0.0",
Expand Down
47 changes: 47 additions & 0 deletions patches/expo-image+2.0.2.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
diff --git a/node_modules/expo-image/android/src/main/java/expo/modules/image/ImageLoadTask.kt b/node_modules/expo-image/android/src/main/java/expo/modules/image/ImageLoadTask.kt
index 46e0bf6..5c75d5d
--- a/node_modules/expo-image/android/src/main/java/expo/modules/image/ImageLoadTask.kt
+++ b/node_modules/expo-image/android/src/main/java/expo/modules/image/ImageLoadTask.kt
@@ -17,26 +18,26 @@ open class ImageLoadTask(private val appContext: AppContext, private val source:
private var task: Job? = null

suspend fun load(promise: Promise) {
- return coroutineScope {
- val deferred = async {
- val context = this@ImageLoadTask.appContext.reactContext ?: throw Exceptions.ReactContextLost()
- withContext(Dispatchers.IO) {
- Glide
- .with(context)
- .asDrawable()
- .load(source.uri)
- .centerInside()
- .submit(options.maxWidth, options.maxHeight)
- .get()
+ try {
+ coroutineScope {
+ val deferred = async {
+ val context = this@ImageLoadTask.appContext.reactContext ?: throw Exceptions.ReactContextLost()
+ withContext(Dispatchers.IO) {
+ Glide
+ .with(context)
+ .asDrawable()
+ .load(source.uri)
+ .centerInside()
+ .submit(options.maxWidth, options.maxHeight)
+ .get()
+ }
}
- }
- task = deferred
- try {
+ task = deferred
val bitmap: Drawable = deferred.await()
promise.resolve(Image(bitmap))
- } catch (e: Exception) {
- promise.reject(ImageLoadFailed(e))
}
+ } catch (e: Exception) {
+ promise.reject(ImageLoadFailed(e))
}
}
}
10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5633,7 +5633,7 @@ __metadata:
expo-clipboard: "npm:~7.0.0"
expo-crypto: "npm:~14.0.1"
expo-document-picker: "npm:~13.0.1"
expo-image: "npm:~2.0.3"
expo-image: "npm:2.0.2"
expo-image-picker: "npm:~16.0.3"
expo-keep-awake: "npm:~14.0.1"
expo-secure-store: "npm:~14.0.0"
Expand Down Expand Up @@ -8837,9 +8837,9 @@ __metadata:
languageName: node
linkType: hard

"expo-image@npm:~2.0.3":
version: 2.0.3
resolution: "expo-image@npm:2.0.3"
"expo-image@npm:2.0.2":
version: 2.0.2
resolution: "expo-image@npm:2.0.2"
peerDependencies:
expo: "*"
react: "*"
Expand All @@ -8848,7 +8848,7 @@ __metadata:
peerDependenciesMeta:
react-native-web:
optional: true
checksum: 10c0/adceac4fbc29e375ed28fab00340db2fa290a0ab149ee296ddc700aadc75ceb9db657abd7a2fea17c1cd0dbd3a07c691df82b61dc684dbccf198ca95d5160a0a
checksum: 10c0/d37c43316600b20291c1b5ec2c0b0f0a280e1cfc87ab8d0b4bff520dc9957f2d73e5be7371a1ce4915fe6189a49687e54a8b96395cfae89e67b60f9ab18fb096
languageName: node
linkType: hard

Expand Down
Loading