Skip to content

Commit

Permalink
add extension function to handle casting (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrissiewasabi authored Jun 18, 2024
1 parent c7ffae8 commit 8ecdcce
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions android/src/main/java/com/rnmovableink/RNMovableInkModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class RNMovableInkModule(reactContext: ReactApplicationContext) :
fun categoryViewed(properties: ReadableMap) {
MIClient.categoryViewed(properties.toHashMap())
}

@ReactMethod
fun productRemoved(properties: ReadableMap) {
MIClient.productRemoved(properties.toHashMap())
Expand Down Expand Up @@ -99,7 +99,15 @@ class RNMovableInkModule(reactContext: ReactApplicationContext) :

@ReactMethod
fun setValidPasteboardValues(values: ReadableArray) {
MIClient.validPasteboardValues(values.toArrayList())
MIClient.validPasteboardValues(values.toStringList())
}

fun ReadableArray.toStringList(): List<String> {
val stringList = mutableListOf<String>()
for (i in 0 until size) {
stringList.add(getString(i))
}
return stringList
}

companion object {
Expand Down

0 comments on commit 8ecdcce

Please sign in to comment.