mrousavy/nitro

Nitro 0.6 - Cannot default-construct HybridObject!

jpudysz opened this issue · 1 comments

Hey!
After upgrading from v.0.5.0 to v.0.6.0, I can no longer construct my Hybrid that depends on another Cxx Hybrid

 auto nativePlatform = Unistyles::NativePlatform::create(); // cxx <-> swift hybrid
 auto unistylesRuntime = std::make_shared<HybridUnistylesRuntime>(nativePlatform); // <- crashes here

Error:

libc++abi: terminating due to uncaught exception of type std::runtime_error: Cannot default-construct HybridObject!

It would be great to still support that, as I don't want to expose NativePlatform to JS.

Sorry there was a breaking change in 0.6.0 which I needed for Android. All specs now virtually inherit from HybridObject, so you need to explicitly call it's constructor. That's all you need to change:

 class SomeHybrid: SomeHybridSpec {
-  SomeHybrid() {}
+  SomeHybrid(): HybridObject(TAG) {}
 }