我正在制作一个 React Native 模块,并且我正在为 Android 使用 kotlin。我的本机模块中有一个方法,如下所示:
@ReactMethod
fun blahblah(promise: Promise) {
try {
// This returns a Set<String> so I have to convert it to a typed array
val data = myMethod.toTypedArray()
promise.resolve(data)
} catch (e: Exception) {
promise.reject(e)
}
}
当我在我的代码中调用它时,我收到了这个错误:
Unhandled promise rejection [Error: Cannot convert argument of type class [Ljava.lang.String;]
这是桥的问题吗?我错过了什么吗?先感谢您。