diff --git a/packages/react-native-nitro-image/android/src/main/java/com/margelo/nitro/image/KotlinTestObject.kt b/packages/react-native-nitro-image/android/src/main/java/com/margelo/nitro/image/KotlinTestObject.kt index 2e69f19d8..dbc571d32 100644 --- a/packages/react-native-nitro-image/android/src/main/java/com/margelo/nitro/image/KotlinTestObject.kt +++ b/packages/react-native-nitro-image/android/src/main/java/com/margelo/nitro/image/KotlinTestObject.kt @@ -39,8 +39,8 @@ class KotlinTestObject: HybridKotlinTestObjectSpec() { map.setString("string", "String!") map.setBoolean("bool", true) map.setBigInt("bigint", 893256789) - map.setAnyObject("object", mapOf("first" to 1, "second" to "string", "third" to mapOf("nested" to true))) - map.setAnyArray("array", arrayOf(11, true, 33.5, "string", arrayOf("nested", true))) + map.setAnyObject("object", mapOf("first" to 1.0, "second" to "string", "third" to mapOf("nested" to true))) + map.setAnyArray("array", arrayOf(11.0, true, 33.5, "string", arrayOf("nested", true))) return map } diff --git a/packages/react-native-nitro-modules/android/src/main/cpp/jsi/JSIConverter+JObject.hpp b/packages/react-native-nitro-modules/android/src/main/cpp/jsi/JSIConverter+JObject.hpp index 58ab74b29..1c6397261 100644 --- a/packages/react-native-nitro-modules/android/src/main/cpp/jsi/JSIConverter+JObject.hpp +++ b/packages/react-native-nitro-modules/android/src/main/cpp/jsi/JSIConverter+JObject.hpp @@ -46,7 +46,13 @@ struct JSIConverter final { return JSIConverter>::toJSI( runtime, jni::static_ref_cast>(boxedValue)); } else [[unlikely]] { - throw std::runtime_error("Cannot convert \"" + boxedValue->toString() + "\" to jsi::Value!"); + // It's an unknown type! Let's give the developer some hints.. + if (boxedValue->isInstanceOf(jni::JInteger::javaClassStatic())) { + throw std::runtime_error("Cannot convert Integer \"" + boxedValue->toString() + + "\" to jsi::Value! JavaScript uses Doubles for numbers."); + } else { + throw std::runtime_error("Cannot convert \"" + boxedValue->toString() + "\" to jsi::Value!"); + } } } static inline jni::local_ref fromJSI(jsi::Runtime& runtime, const jsi::Value& value) {