We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6353180 commit ce4778aCopy full SHA for ce4778a
android/src/main/mapbox-v11-compat/v11/com/rnmapbox/rnmbx/v11compat/Image.kt
@@ -26,7 +26,16 @@ fun ByteArray.toImageData() : DataRef {
26
}
27
28
fun DataRef.toByteArray(): ByteArray {
29
- return this.buffer.array()
+ if (this.buffer.hasArray()) {
30
+ return this.buffer.array()
31
+ } else {
32
+ val buffer = this.buffer
33
+ val bytes = ByteArray(buffer.remaining())
34
+ val oldPos = buffer.position()
35
+ buffer.get(bytes)
36
+ buffer.position(oldPos)
37
+ return bytes
38
+ }
39
40
/*
41
fun Drawable.toImageHolder(drawableId: Int) : ImageHolder {
0 commit comments