Skip to content

Commit

Permalink
fix: add android side
Browse files Browse the repository at this point in the history
  • Loading branch information
gtokman committed Nov 2, 2024
1 parent 807e746 commit 1dccbd1
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,19 @@ import com.facebook.react.uimanager.events.RCTEventEmitter
imageLoader.diskCache?.clear()
promise.resolve(true)
}

@OptIn(ExperimentalCoilApi::class)
@ReactMethod
fun prefetch(sources: Array<String>, promise: Promise) {
val imageLoader = reactApplicationContext.imageLoader
val requests = sources.map { url ->
ImageRequest.Builder(reactApplicationContext)
.data(url)
.build()
}
imageLoader.enqueue(requests)
promise.resolve(null)
}
}

class FasterImageViewManager : SimpleViewManager<AppCompatImageView>() {
Expand Down

0 comments on commit 1dccbd1

Please sign in to comment.