From 1fb7789fb4bf57913c3612e2276755bd47c64d57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mikl=C3=B3s=20Fazekas?= Date: Tue, 18 Nov 2025 21:51:47 +0100 Subject: [PATCH 1/9] feat: onError property for RiveView --- .../com/margelo/nitro/rive/HybridRiveView.kt | 25 +++++- ios/HybridRiveView.swift | 42 +++++++++- ios/RiveReactNativeView.swift | 12 ++- ios/Utils.swift | 9 -- .../android/c++/JFunc_void_RiveError.hpp | 79 ++++++++++++++++++ .../android/c++/JHybridRiveViewSpec.cpp | 30 ++++++- .../android/c++/JHybridRiveViewSpec.hpp | 2 + nitrogen/generated/android/c++/JRiveError.hpp | 63 ++++++++++++++ .../generated/android/c++/JRiveErrorType.hpp | 77 +++++++++++++++++ .../c++/views/JHybridRiveViewStateUpdater.cpp | 4 + .../margelo/nitro/rive/Func_void_RiveError.kt | 80 ++++++++++++++++++ .../margelo/nitro/rive/HybridRiveViewSpec.kt | 14 ++++ .../com/margelo/nitro/rive/RiveError.kt | 41 +++++++++ .../com/margelo/nitro/rive/RiveErrorType.kt | 27 ++++++ nitrogen/generated/android/riveOnLoad.cpp | 2 + .../generated/ios/Rive-Swift-Cxx-Bridge.cpp | 8 ++ .../generated/ios/Rive-Swift-Cxx-Bridge.hpp | 28 +++++++ .../generated/ios/Rive-Swift-Cxx-Umbrella.hpp | 6 ++ .../ios/c++/HybridRiveViewSpecSwift.hpp | 15 +++- .../ios/c++/views/HybridRiveViewComponent.mm | 5 ++ .../ios/swift/Func_void_RiveError.swift | 47 +++++++++++ .../ios/swift/HybridRiveViewSpec.swift | 1 + .../ios/swift/HybridRiveViewSpec_cxx.swift | 19 +++++ nitrogen/generated/ios/swift/RiveError.swift | 46 ++++++++++ .../generated/ios/swift/RiveErrorType.swift | 64 ++++++++++++++ .../shared/c++/HybridRiveViewSpec.cpp | 2 + .../shared/c++/HybridRiveViewSpec.hpp | 7 +- nitrogen/generated/shared/c++/RiveError.hpp | 81 ++++++++++++++++++ .../generated/shared/c++/RiveErrorType.hpp | 68 +++++++++++++++ .../c++/views/HybridRiveViewComponent.cpp | 12 +++ .../c++/views/HybridRiveViewComponent.hpp | 4 +- .../generated/shared/json/RiveViewConfig.json | 1 + src/core/Errors.ts | 15 ++++ src/core/RiveView.tsx | 47 +++++++++++ src/hooks/useRive.ts | 83 +++++++++---------- src/index.tsx | 55 +++++------- src/specs/RiveView.nitro.ts | 3 + 37 files changed, 1024 insertions(+), 100 deletions(-) create mode 100644 nitrogen/generated/android/c++/JFunc_void_RiveError.hpp create mode 100644 nitrogen/generated/android/c++/JRiveError.hpp create mode 100644 nitrogen/generated/android/c++/JRiveErrorType.hpp create mode 100644 nitrogen/generated/android/kotlin/com/margelo/nitro/rive/Func_void_RiveError.kt create mode 100644 nitrogen/generated/android/kotlin/com/margelo/nitro/rive/RiveError.kt create mode 100644 nitrogen/generated/android/kotlin/com/margelo/nitro/rive/RiveErrorType.kt create mode 100644 nitrogen/generated/ios/swift/Func_void_RiveError.swift create mode 100644 nitrogen/generated/ios/swift/RiveError.swift create mode 100644 nitrogen/generated/ios/swift/RiveErrorType.swift create mode 100644 nitrogen/generated/shared/c++/RiveError.hpp create mode 100644 nitrogen/generated/shared/c++/RiveErrorType.hpp create mode 100644 src/core/Errors.ts create mode 100644 src/core/RiveView.tsx diff --git a/android/src/main/java/com/margelo/nitro/rive/HybridRiveView.kt b/android/src/main/java/com/margelo/nitro/rive/HybridRiveView.kt index 45cb9e51..b2120eab 100644 --- a/android/src/main/java/com/margelo/nitro/rive/HybridRiveView.kt +++ b/android/src/main/java/com/margelo/nitro/rive/HybridRiveView.kt @@ -85,6 +85,7 @@ class HybridRiveView(val context: ThemedReactContext) : HybridRiveViewSpec() { dataBindingChanged = true } } + override var onError: (error: RiveError) -> Unit = {} //endregion //region View Methods @@ -223,12 +224,32 @@ class HybridRiveView(val context: ThemedReactContext) : HybridRiveViewSpec() { } } + private fun detectErrorType(exception: Exception): RiveErrorType { + val errorMessage = exception.message?.lowercase() ?: "" + + return when { + errorMessage.contains("artboard") -> RiveErrorType.INCORRECTARTBOARDNAME + errorMessage.contains("state machine") -> RiveErrorType.INCORRECTSTATEMACHINENAME + errorMessage.contains("animation") -> RiveErrorType.INCORRECTANIMATIONNAME + errorMessage.contains("data binding") || errorMessage.contains("databinding") -> RiveErrorType.DATABINDINGERROR + errorMessage.contains("text run") -> RiveErrorType.TEXTRUNNOTFOUNDERROR + errorMessage.contains("file") || errorMessage.contains("not found") -> RiveErrorType.FILENOTFOUND + errorMessage.contains("malformed") || errorMessage.contains("corrupt") -> RiveErrorType.MALFORMEDFILE + else -> RiveErrorType.UNKNOWN + } + } + fun logged(tag: String, note: String? = null, fn: () -> Unit) { try { fn() } catch (e: Exception) { - // TODO add onError callback - Log.e("[RIVE]", "$tag ${note ?: ""} $e") + val errorMessage = "[RIVE] $tag ${note ?: ""} $e" + val errorType = detectErrorType(e) + val riveError = RiveError( + type = errorType, + message = errorMessage + ) + onError(riveError) } } //endregion diff --git a/ios/HybridRiveView.swift b/ios/HybridRiveView.swift index 3cd95eee..31de9b79 100644 --- a/ios/HybridRiveView.swift +++ b/ios/HybridRiveView.swift @@ -56,6 +56,7 @@ class HybridRiveView: HybridRiveViewSpec { var alignment: Alignment? var fit: Fit? var layoutScaleFactor: Double? + var onError: (RiveError) -> Void = { _ in } func awaitViewReady() throws -> Promise { return Promise.async { [self] in @@ -141,7 +142,7 @@ class HybridRiveView: HybridRiveViewSpec { ) let riveView = try getRiveView() - riveView.configure( + try riveView.configure( config, dataBindingChanged: dataBindingChanged, reload: needsReload, initialUpdate: initialUpdate) needsReload = false @@ -187,3 +188,42 @@ class HybridRiveView: HybridRiveViewSpec { } } } + +extension HybridRiveView { + func logged(tag: String, note: String? = nil, _ fn: () throws -> Void) { + do { + return try fn() + } catch (let e) { + let errorType = detectErrorType(e) + let errorMessage = "[RIVE] \(tag) \(note ?? "") \(e)" + + let riveError = RiveError( + message: errorMessage, + type: errorType, + ) + onError(riveError) + } + } + + private func detectErrorType(_ error: Error) -> RiveErrorType { + let errorDescription = String(describing: error).lowercased() + + if errorDescription.contains("artboard") { + return .incorrectartboardname + } else if errorDescription.contains("state machine") { + return .incorrectstatemachinename + } else if errorDescription.contains("animation") { + return .incorrectanimationname + } else if errorDescription.contains("data binding") || errorDescription.contains("databinding") { + return .databindingerror + } else if errorDescription.contains("text run") { + return .textrunnotfounderror + } else if errorDescription.contains("file") || errorDescription.contains("not found") { + return .filenotfound + } else if errorDescription.contains("malformed") || errorDescription.contains("corrupt") { + return .malformedfile + } else { + return .unknown + } + } +} diff --git a/ios/RiveReactNativeView.swift b/ios/RiveReactNativeView.swift index 3c99e8e2..b14b9079 100644 --- a/ios/RiveReactNativeView.swift +++ b/ios/RiveReactNativeView.swift @@ -26,6 +26,10 @@ struct ViewConfiguration { let bindData: BindData } +enum NativeRiveError: Error { + case instanceNotFound(message: String) +} + class RiveReactNativeView: UIView, RiveStateMachineDelegate { // MARK: Internal Properties private var riveView: RiveView? @@ -50,7 +54,7 @@ class RiveReactNativeView: UIView, RiveStateMachineDelegate { return true } - func configure(_ config: ViewConfiguration, dataBindingChanged: Bool = false, reload: Bool = false, initialUpdate: Bool = false) { + func configure(_ config: ViewConfiguration, dataBindingChanged: Bool = false, reload: Bool = false, initialUpdate: Bool = false) throws { if reload { cleanup() let model = RiveModel(riveFile: config.riveFile) @@ -75,7 +79,7 @@ class RiveReactNativeView: UIView, RiveStateMachineDelegate { } if dataBindingChanged || initialUpdate { - applyDataBinding(config.bindData) + try applyDataBinding(config.bindData) } } @@ -87,7 +91,7 @@ class RiveReactNativeView: UIView, RiveStateMachineDelegate { return baseViewModel?.riveModel?.stateMachine?.viewModelInstance } - func applyDataBinding(_ bindData: BindData) { + func applyDataBinding(_ bindData: BindData) throws { let stateMachine = baseViewModel?.riveModel?.stateMachine let artboard = baseViewModel?.riveModel?.artboard @@ -106,7 +110,7 @@ class RiveReactNativeView: UIView, RiveStateMachineDelegate { let viewModel = riveFile.defaultViewModel(for: artboard), let instance = viewModel.createInstance(fromName: name) else { - return + throw NativeRiveError.instanceNotFound(message: "\(name) instance not found") } stateMachine?.bind(viewModelInstance: instance) // this should be added if we support only playing artboards on their own - https://github.com/rive-app/rive-nitro-react-native/pull/23#discussion_r2534698281 diff --git a/ios/Utils.swift b/ios/Utils.swift index f5ef2bbc..ad8ed6a8 100644 --- a/ios/Utils.swift +++ b/ios/Utils.swift @@ -13,12 +13,3 @@ final class SendableRef: @unchecked Sendable { self.value = value } } - -/// Executes a closure, logging any thrown error with an optional note and tag using RCTLogError. -func logged(tag: String, note: String? = nil, _ fn: () throws -> Void) { - do { - return try fn() - } catch (let e) { - RCTLogError("[RIVE] \(tag) \(note ?? "") \(e)") - } -} diff --git a/nitrogen/generated/android/c++/JFunc_void_RiveError.hpp b/nitrogen/generated/android/c++/JFunc_void_RiveError.hpp new file mode 100644 index 00000000..12d35760 --- /dev/null +++ b/nitrogen/generated/android/c++/JFunc_void_RiveError.hpp @@ -0,0 +1,79 @@ +/// +/// JFunc_void_RiveError.hpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © 2025 Marc Rousavy @ Margelo +/// + +#pragma once + +#include +#include + +#include "RiveError.hpp" +#include +#include "JRiveError.hpp" +#include +#include "RiveErrorType.hpp" +#include "JRiveErrorType.hpp" + +namespace margelo::nitro::rive { + + using namespace facebook; + + /** + * Represents the Java/Kotlin callback `(error: RiveError) -> Unit`. + * This can be passed around between C++ and Java/Kotlin. + */ + struct JFunc_void_RiveError: public jni::JavaClass { + public: + static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/rive/Func_void_RiveError;"; + + public: + /** + * Invokes the function this `JFunc_void_RiveError` instance holds through JNI. + */ + void invoke(const RiveError& error) const { + static const auto method = javaClassStatic()->getMethod /* error */)>("invoke"); + method(self(), JRiveError::fromCpp(error)); + } + }; + + /** + * An implementation of Func_void_RiveError that is backed by a C++ implementation (using `std::function<...>`) + */ + struct JFunc_void_RiveError_cxx final: public jni::HybridClass { + public: + static jni::local_ref fromCpp(const std::function& func) { + return JFunc_void_RiveError_cxx::newObjectCxxArgs(func); + } + + public: + /** + * Invokes the C++ `std::function<...>` this `JFunc_void_RiveError_cxx` instance holds. + */ + void invoke_cxx(jni::alias_ref error) { + _func(error->toCpp()); + } + + public: + [[nodiscard]] + inline const std::function& getFunction() const { + return _func; + } + + public: + static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/rive/Func_void_RiveError_cxx;"; + static void registerNatives() { + registerHybrid({makeNativeMethod("invoke_cxx", JFunc_void_RiveError_cxx::invoke_cxx)}); + } + + private: + explicit JFunc_void_RiveError_cxx(const std::function& func): _func(func) { } + + private: + friend HybridBase; + std::function _func; + }; + +} // namespace margelo::nitro::rive diff --git a/nitrogen/generated/android/c++/JHybridRiveViewSpec.cpp b/nitrogen/generated/android/c++/JHybridRiveViewSpec.cpp index 6ac225d0..586a02cb 100644 --- a/nitrogen/generated/android/c++/JHybridRiveViewSpec.cpp +++ b/nitrogen/generated/android/c++/JHybridRiveViewSpec.cpp @@ -19,6 +19,10 @@ namespace margelo::nitro::rive { class HybridViewModelInstanceSpec; } namespace margelo::nitro::rive { enum class DataBindMode; } // Forward declaration of `DataBindByName` to properly resolve imports. namespace margelo::nitro::rive { struct DataBindByName; } +// Forward declaration of `RiveError` to properly resolve imports. +namespace margelo::nitro::rive { struct RiveError; } +// Forward declaration of `RiveErrorType` to properly resolve imports. +namespace margelo::nitro::rive { enum class RiveErrorType; } // Forward declaration of `UnifiedRiveEvent` to properly resolve imports. namespace margelo::nitro::rive { struct UnifiedRiveEvent; } // Forward declaration of `RiveEventType` to properly resolve imports. @@ -41,10 +45,15 @@ namespace margelo::nitro::rive { enum class RiveEventType; } #include "JHybridViewModelInstanceSpec.hpp" #include "JDataBindMode.hpp" #include "JDataBindByName.hpp" +#include "RiveError.hpp" +#include +#include "JFunc_void_RiveError.hpp" +#include "JRiveError.hpp" +#include "RiveErrorType.hpp" +#include "JRiveErrorType.hpp" #include #include #include "UnifiedRiveEvent.hpp" -#include #include "JFunc_void_UnifiedRiveEvent.hpp" #include "JUnifiedRiveEvent.hpp" #include "RiveEventType.hpp" @@ -153,6 +162,25 @@ namespace margelo::nitro::rive { static const auto method = javaClassStatic()->getMethod /* dataBind */)>("setDataBind"); method(_javaPart, dataBind.has_value() ? JVariant_HybridViewModelInstanceSpec_DataBindMode_DataBindByName::fromCpp(dataBind.value()) : nullptr); } + std::function JHybridRiveViewSpec::getOnError() { + static const auto method = javaClassStatic()->getMethod()>("getOnError_cxx"); + auto __result = method(_javaPart); + return [&]() -> std::function { + if (__result->isInstanceOf(JFunc_void_RiveError_cxx::javaClassStatic())) [[likely]] { + auto downcast = jni::static_ref_cast(__result); + return downcast->cthis()->getFunction(); + } else { + auto __resultRef = jni::make_global(__result); + return [__resultRef](RiveError error) -> void { + return __resultRef->invoke(error); + }; + } + }(); + } + void JHybridRiveViewSpec::setOnError(const std::function& onError) { + static const auto method = javaClassStatic()->getMethod /* onError */)>("setOnError_cxx"); + method(_javaPart, JFunc_void_RiveError_cxx::fromCpp(onError)); + } // Methods std::shared_ptr> JHybridRiveViewSpec::awaitViewReady() { diff --git a/nitrogen/generated/android/c++/JHybridRiveViewSpec.hpp b/nitrogen/generated/android/c++/JHybridRiveViewSpec.hpp index 7ffd4db1..9ba7c91b 100644 --- a/nitrogen/generated/android/c++/JHybridRiveViewSpec.hpp +++ b/nitrogen/generated/android/c++/JHybridRiveViewSpec.hpp @@ -66,6 +66,8 @@ namespace margelo::nitro::rive { void setLayoutScaleFactor(std::optional layoutScaleFactor) override; std::optional, DataBindMode, DataBindByName>> getDataBind() override; void setDataBind(const std::optional, DataBindMode, DataBindByName>>& dataBind) override; + std::function getOnError() override; + void setOnError(const std::function& onError) override; public: // Methods diff --git a/nitrogen/generated/android/c++/JRiveError.hpp b/nitrogen/generated/android/c++/JRiveError.hpp new file mode 100644 index 00000000..5980d308 --- /dev/null +++ b/nitrogen/generated/android/c++/JRiveError.hpp @@ -0,0 +1,63 @@ +/// +/// JRiveError.hpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © 2025 Marc Rousavy @ Margelo +/// + +#pragma once + +#include +#include "RiveError.hpp" + +#include "JRiveErrorType.hpp" +#include "RiveErrorType.hpp" +#include + +namespace margelo::nitro::rive { + + using namespace facebook; + + /** + * The C++ JNI bridge between the C++ struct "RiveError" and the the Kotlin data class "RiveError". + */ + struct JRiveError final: public jni::JavaClass { + public: + static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/rive/RiveError;"; + + public: + /** + * Convert this Java/Kotlin-based struct to the C++ struct RiveError by copying all values to C++. + */ + [[maybe_unused]] + [[nodiscard]] + RiveError toCpp() const { + static const auto clazz = javaClassStatic(); + static const auto fieldMessage = clazz->getField("message"); + jni::local_ref message = this->getFieldValue(fieldMessage); + static const auto fieldType = clazz->getField("type"); + jni::local_ref type = this->getFieldValue(fieldType); + return RiveError( + message->toStdString(), + type->toCpp() + ); + } + + public: + /** + * Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java. + */ + [[maybe_unused]] + static jni::local_ref fromCpp(const RiveError& value) { + using JSignature = JRiveError(jni::alias_ref, jni::alias_ref); + static const auto clazz = javaClassStatic(); + static const auto create = clazz->getStaticMethod("fromCpp"); + return create( + clazz, + jni::make_jstring(value.message), + JRiveErrorType::fromCpp(value.type) + ); + } + }; + +} // namespace margelo::nitro::rive diff --git a/nitrogen/generated/android/c++/JRiveErrorType.hpp b/nitrogen/generated/android/c++/JRiveErrorType.hpp new file mode 100644 index 00000000..afef86ee --- /dev/null +++ b/nitrogen/generated/android/c++/JRiveErrorType.hpp @@ -0,0 +1,77 @@ +/// +/// JRiveErrorType.hpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © 2025 Marc Rousavy @ Margelo +/// + +#pragma once + +#include +#include "RiveErrorType.hpp" + +namespace margelo::nitro::rive { + + using namespace facebook; + + /** + * The C++ JNI bridge between the C++ enum "RiveErrorType" and the the Kotlin enum "RiveErrorType". + */ + struct JRiveErrorType final: public jni::JavaClass { + public: + static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/rive/RiveErrorType;"; + + public: + /** + * Convert this Java/Kotlin-based enum to the C++ enum RiveErrorType. + */ + [[maybe_unused]] + [[nodiscard]] + RiveErrorType toCpp() const { + static const auto clazz = javaClassStatic(); + static const auto fieldOrdinal = clazz->getField("value"); + int ordinal = this->getFieldValue(fieldOrdinal); + return static_cast(ordinal); + } + + public: + /** + * Create a Java/Kotlin-based enum with the given C++ enum's value. + */ + [[maybe_unused]] + static jni::alias_ref fromCpp(RiveErrorType value) { + static const auto clazz = javaClassStatic(); + static const auto fieldUNKNOWN = clazz->getStaticField("UNKNOWN"); + static const auto fieldFILENOTFOUND = clazz->getStaticField("FILENOTFOUND"); + static const auto fieldMALFORMEDFILE = clazz->getStaticField("MALFORMEDFILE"); + static const auto fieldINCORRECTARTBOARDNAME = clazz->getStaticField("INCORRECTARTBOARDNAME"); + static const auto fieldINCORRECTSTATEMACHINENAME = clazz->getStaticField("INCORRECTSTATEMACHINENAME"); + static const auto fieldINCORRECTANIMATIONNAME = clazz->getStaticField("INCORRECTANIMATIONNAME"); + static const auto fieldDATABINDINGERROR = clazz->getStaticField("DATABINDINGERROR"); + static const auto fieldTEXTRUNNOTFOUNDERROR = clazz->getStaticField("TEXTRUNNOTFOUNDERROR"); + + switch (value) { + case RiveErrorType::UNKNOWN: + return clazz->getStaticFieldValue(fieldUNKNOWN); + case RiveErrorType::FILENOTFOUND: + return clazz->getStaticFieldValue(fieldFILENOTFOUND); + case RiveErrorType::MALFORMEDFILE: + return clazz->getStaticFieldValue(fieldMALFORMEDFILE); + case RiveErrorType::INCORRECTARTBOARDNAME: + return clazz->getStaticFieldValue(fieldINCORRECTARTBOARDNAME); + case RiveErrorType::INCORRECTSTATEMACHINENAME: + return clazz->getStaticFieldValue(fieldINCORRECTSTATEMACHINENAME); + case RiveErrorType::INCORRECTANIMATIONNAME: + return clazz->getStaticFieldValue(fieldINCORRECTANIMATIONNAME); + case RiveErrorType::DATABINDINGERROR: + return clazz->getStaticFieldValue(fieldDATABINDINGERROR); + case RiveErrorType::TEXTRUNNOTFOUNDERROR: + return clazz->getStaticFieldValue(fieldTEXTRUNNOTFOUNDERROR); + default: + std::string stringValue = std::to_string(static_cast(value)); + throw std::invalid_argument("Invalid enum value (" + stringValue + "!"); + } + } + }; + +} // namespace margelo::nitro::rive diff --git a/nitrogen/generated/android/c++/views/JHybridRiveViewStateUpdater.cpp b/nitrogen/generated/android/c++/views/JHybridRiveViewStateUpdater.cpp index a54a6113..590d2b83 100644 --- a/nitrogen/generated/android/c++/views/JHybridRiveViewStateUpdater.cpp +++ b/nitrogen/generated/android/c++/views/JHybridRiveViewStateUpdater.cpp @@ -68,6 +68,10 @@ void JHybridRiveViewStateUpdater::updateViewProps(jni::alias_ref /* view->setDataBind(props.dataBind.value); // TODO: Set isDirty = false } + if (props.onError.isDirty) { + view->setOnError(props.onError.value); + // TODO: Set isDirty = false + } // Update hybridRef if it changed if (props.hybridRef.isDirty) { diff --git a/nitrogen/generated/android/kotlin/com/margelo/nitro/rive/Func_void_RiveError.kt b/nitrogen/generated/android/kotlin/com/margelo/nitro/rive/Func_void_RiveError.kt new file mode 100644 index 00000000..2f706a95 --- /dev/null +++ b/nitrogen/generated/android/kotlin/com/margelo/nitro/rive/Func_void_RiveError.kt @@ -0,0 +1,80 @@ +/// +/// Func_void_RiveError.kt +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © 2025 Marc Rousavy @ Margelo +/// + +package com.margelo.nitro.rive + +import androidx.annotation.Keep +import com.facebook.jni.HybridData +import com.facebook.proguard.annotations.DoNotStrip +import dalvik.annotation.optimization.FastNative + + +/** + * Represents the JavaScript callback `(error: struct) => void`. + * This can be either implemented in C++ (in which case it might be a callback coming from JS), + * or in Kotlin/Java (in which case it is a native callback). + */ +@DoNotStrip +@Keep +@Suppress("ClassName", "RedundantUnitReturnType") +fun interface Func_void_RiveError: (RiveError) -> Unit { + /** + * Call the given JS callback. + * @throws Throwable if the JS function itself throws an error, or if the JS function/runtime has already been deleted. + */ + @DoNotStrip + @Keep + override fun invoke(error: RiveError): Unit +} + +/** + * Represents the JavaScript callback `(error: struct) => void`. + * This is implemented in C++, via a `std::function<...>`. + * The callback might be coming from JS. + */ +@DoNotStrip +@Keep +@Suppress( + "KotlinJniMissingFunction", "unused", + "RedundantSuppression", "RedundantUnitReturnType", "FunctionName", + "ConvertSecondaryConstructorToPrimary", "ClassName", "LocalVariableName", +) +class Func_void_RiveError_cxx: Func_void_RiveError { + @DoNotStrip + @Keep + private val mHybridData: HybridData + + @DoNotStrip + @Keep + private constructor(hybridData: HybridData) { + mHybridData = hybridData + } + + @DoNotStrip + @Keep + override fun invoke(error: RiveError): Unit + = invoke_cxx(error) + + @FastNative + private external fun invoke_cxx(error: RiveError): Unit +} + +/** + * Represents the JavaScript callback `(error: struct) => void`. + * This is implemented in Java/Kotlin, via a `(RiveError) -> Unit`. + * The callback is always coming from native. + */ +@DoNotStrip +@Keep +@Suppress("ClassName", "RedundantUnitReturnType", "unused") +class Func_void_RiveError_java(private val function: (RiveError) -> Unit): Func_void_RiveError { + @DoNotStrip + @Keep + override fun invoke(error: RiveError): Unit { + return this.function(error) + } +} diff --git a/nitrogen/generated/android/kotlin/com/margelo/nitro/rive/HybridRiveViewSpec.kt b/nitrogen/generated/android/kotlin/com/margelo/nitro/rive/HybridRiveViewSpec.kt index 94744b36..4fb35639 100644 --- a/nitrogen/generated/android/kotlin/com/margelo/nitro/rive/HybridRiveViewSpec.kt +++ b/nitrogen/generated/android/kotlin/com/margelo/nitro/rive/HybridRiveViewSpec.kt @@ -90,6 +90,20 @@ abstract class HybridRiveViewSpec: HybridView() { @set:DoNotStrip @set:Keep abstract var dataBind: Variant_HybridViewModelInstanceSpec_DataBindMode_DataBindByName? + + abstract var onError: (error: RiveError) -> Unit + + private var onError_cxx: Func_void_RiveError + @Keep + @DoNotStrip + get() { + return Func_void_RiveError_java(onError) + } + @Keep + @DoNotStrip + set(value) { + onError = value + } // Methods @DoNotStrip diff --git a/nitrogen/generated/android/kotlin/com/margelo/nitro/rive/RiveError.kt b/nitrogen/generated/android/kotlin/com/margelo/nitro/rive/RiveError.kt new file mode 100644 index 00000000..4124419f --- /dev/null +++ b/nitrogen/generated/android/kotlin/com/margelo/nitro/rive/RiveError.kt @@ -0,0 +1,41 @@ +/// +/// RiveError.kt +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © 2025 Marc Rousavy @ Margelo +/// + +package com.margelo.nitro.rive + +import androidx.annotation.Keep +import com.facebook.proguard.annotations.DoNotStrip + + +/** + * Represents the JavaScript object/struct "RiveError". + */ +@DoNotStrip +@Keep +data class RiveError( + @DoNotStrip + @Keep + val message: String, + @DoNotStrip + @Keep + val type: RiveErrorType +) { + /* primary constructor */ + + private companion object { + /** + * Constructor called from C++ + */ + @DoNotStrip + @Keep + @Suppress("unused") + @JvmStatic + private fun fromCpp(message: String, type: RiveErrorType): RiveError { + return RiveError(message, type) + } + } +} diff --git a/nitrogen/generated/android/kotlin/com/margelo/nitro/rive/RiveErrorType.kt b/nitrogen/generated/android/kotlin/com/margelo/nitro/rive/RiveErrorType.kt new file mode 100644 index 00000000..a9ed8331 --- /dev/null +++ b/nitrogen/generated/android/kotlin/com/margelo/nitro/rive/RiveErrorType.kt @@ -0,0 +1,27 @@ +/// +/// RiveErrorType.kt +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © 2025 Marc Rousavy @ Margelo +/// + +package com.margelo.nitro.rive + +import androidx.annotation.Keep +import com.facebook.proguard.annotations.DoNotStrip + +/** + * Represents the JavaScript enum/union "RiveErrorType". + */ +@DoNotStrip +@Keep +enum class RiveErrorType(@DoNotStrip @Keep val value: Int) { + UNKNOWN(0), + FILENOTFOUND(1), + MALFORMEDFILE(2), + INCORRECTARTBOARDNAME(3), + INCORRECTSTATEMACHINENAME(4), + INCORRECTANIMATIONNAME(5), + DATABINDINGERROR(6), + TEXTRUNNOTFOUNDERROR(7); +} diff --git a/nitrogen/generated/android/riveOnLoad.cpp b/nitrogen/generated/android/riveOnLoad.cpp index 9b0561a5..26442587 100644 --- a/nitrogen/generated/android/riveOnLoad.cpp +++ b/nitrogen/generated/android/riveOnLoad.cpp @@ -19,6 +19,7 @@ #include "JHybridRiveFileSpec.hpp" #include "JHybridRiveFileFactorySpec.hpp" #include "JHybridRiveViewSpec.hpp" +#include "JFunc_void_RiveError.hpp" #include "JFunc_void_UnifiedRiveEvent.hpp" #include "views/JHybridRiveViewStateUpdater.hpp" #include "JHybridViewModelSpec.hpp" @@ -49,6 +50,7 @@ int initialize(JavaVM* vm) { margelo::nitro::rive::JHybridRiveFileSpec::registerNatives(); margelo::nitro::rive::JHybridRiveFileFactorySpec::registerNatives(); margelo::nitro::rive::JHybridRiveViewSpec::registerNatives(); + margelo::nitro::rive::JFunc_void_RiveError_cxx::registerNatives(); margelo::nitro::rive::JFunc_void_UnifiedRiveEvent_cxx::registerNatives(); margelo::nitro::rive::views::JHybridRiveViewStateUpdater::registerNatives(); margelo::nitro::rive::JHybridViewModelSpec::registerNatives(); diff --git a/nitrogen/generated/ios/Rive-Swift-Cxx-Bridge.cpp b/nitrogen/generated/ios/Rive-Swift-Cxx-Bridge.cpp index 9d3686b8..e1281ab1 100644 --- a/nitrogen/generated/ios/Rive-Swift-Cxx-Bridge.cpp +++ b/nitrogen/generated/ios/Rive-Swift-Cxx-Bridge.cpp @@ -121,6 +121,14 @@ namespace margelo::nitro::rive::bridge::swift { return swiftPart.toUnsafe(); } + // pragma MARK: std::function + Func_void_RiveError create_Func_void_RiveError(void* NON_NULL swiftClosureWrapper) noexcept { + auto swiftClosure = Rive::Func_void_RiveError::fromUnsafe(swiftClosureWrapper); + return [swiftClosure = std::move(swiftClosure)](const RiveError& error) mutable -> void { + swiftClosure.call(error); + }; + } + // pragma MARK: std::function Func_void_bool create_Func_void_bool(void* NON_NULL swiftClosureWrapper) noexcept { auto swiftClosure = Rive::Func_void_bool::fromUnsafe(swiftClosureWrapper); diff --git a/nitrogen/generated/ios/Rive-Swift-Cxx-Bridge.hpp b/nitrogen/generated/ios/Rive-Swift-Cxx-Bridge.hpp index 1a78f1ca..cbf738c5 100644 --- a/nitrogen/generated/ios/Rive-Swift-Cxx-Bridge.hpp +++ b/nitrogen/generated/ios/Rive-Swift-Cxx-Bridge.hpp @@ -50,6 +50,10 @@ namespace margelo::nitro::rive { class HybridViewModelTriggerPropertySpec; } namespace margelo::nitro::rive { struct ReferencedAssetsType; } // Forward declaration of `ResolvedReferencedAsset` to properly resolve imports. namespace margelo::nitro::rive { struct ResolvedReferencedAsset; } +// Forward declaration of `RiveErrorType` to properly resolve imports. +namespace margelo::nitro::rive { enum class RiveErrorType; } +// Forward declaration of `RiveError` to properly resolve imports. +namespace margelo::nitro::rive { struct RiveError; } // Forward declaration of `RiveEventType` to properly resolve imports. namespace margelo::nitro::rive { enum class RiveEventType; } // Forward declaration of `UnifiedRiveEvent` to properly resolve imports. @@ -105,6 +109,8 @@ namespace Rive { class HybridViewModelTriggerPropertySpec_cxx; } #include "HybridViewModelTriggerPropertySpec.hpp" #include "ReferencedAssetsType.hpp" #include "ResolvedReferencedAsset.hpp" +#include "RiveError.hpp" +#include "RiveErrorType.hpp" #include "RiveEventType.hpp" #include "UnifiedRiveEvent.hpp" #include @@ -486,6 +492,28 @@ namespace margelo::nitro::rive::bridge::swift { return *optional; } + // pragma MARK: std::function + /** + * Specialized version of `std::function`. + */ + using Func_void_RiveError = std::function; + /** + * Wrapper class for a `std::function`, this can be used from Swift. + */ + class Func_void_RiveError_Wrapper final { + public: + explicit Func_void_RiveError_Wrapper(std::function&& func): _function(std::make_unique>(std::move(func))) {} + inline void call(RiveError error) const noexcept { + _function->operator()(error); + } + private: + std::unique_ptr> _function; + } SWIFT_NONCOPYABLE; + Func_void_RiveError create_Func_void_RiveError(void* NON_NULL swiftClosureWrapper) noexcept; + inline Func_void_RiveError_Wrapper wrap_Func_void_RiveError(Func_void_RiveError value) noexcept { + return Func_void_RiveError_Wrapper(std::move(value)); + } + // pragma MARK: std::shared_ptr> /** * Specialized version of `std::shared_ptr>`. diff --git a/nitrogen/generated/ios/Rive-Swift-Cxx-Umbrella.hpp b/nitrogen/generated/ios/Rive-Swift-Cxx-Umbrella.hpp index 3b0f52e3..208b986f 100644 --- a/nitrogen/generated/ios/Rive-Swift-Cxx-Umbrella.hpp +++ b/nitrogen/generated/ios/Rive-Swift-Cxx-Umbrella.hpp @@ -50,6 +50,10 @@ namespace margelo::nitro::rive { class HybridViewModelTriggerPropertySpec; } namespace margelo::nitro::rive { struct ReferencedAssetsType; } // Forward declaration of `ResolvedReferencedAsset` to properly resolve imports. namespace margelo::nitro::rive { struct ResolvedReferencedAsset; } +// Forward declaration of `RiveErrorType` to properly resolve imports. +namespace margelo::nitro::rive { enum class RiveErrorType; } +// Forward declaration of `RiveError` to properly resolve imports. +namespace margelo::nitro::rive { struct RiveError; } // Forward declaration of `RiveEventType` to properly resolve imports. namespace margelo::nitro::rive { enum class RiveEventType; } // Forward declaration of `UnifiedRiveEvent` to properly resolve imports. @@ -77,6 +81,8 @@ namespace margelo::nitro::rive { struct UnifiedRiveEvent; } #include "HybridViewModelTriggerPropertySpec.hpp" #include "ReferencedAssetsType.hpp" #include "ResolvedReferencedAsset.hpp" +#include "RiveError.hpp" +#include "RiveErrorType.hpp" #include "RiveEventType.hpp" #include "UnifiedRiveEvent.hpp" #include diff --git a/nitrogen/generated/ios/c++/HybridRiveViewSpecSwift.hpp b/nitrogen/generated/ios/c++/HybridRiveViewSpecSwift.hpp index 686546f1..dcfd15d5 100644 --- a/nitrogen/generated/ios/c++/HybridRiveViewSpecSwift.hpp +++ b/nitrogen/generated/ios/c++/HybridRiveViewSpecSwift.hpp @@ -24,6 +24,10 @@ namespace margelo::nitro::rive { class HybridViewModelInstanceSpec; } namespace margelo::nitro::rive { enum class DataBindMode; } // Forward declaration of `DataBindByName` to properly resolve imports. namespace margelo::nitro::rive { struct DataBindByName; } +// Forward declaration of `RiveError` to properly resolve imports. +namespace margelo::nitro::rive { struct RiveError; } +// Forward declaration of `RiveErrorType` to properly resolve imports. +namespace margelo::nitro::rive { enum class RiveErrorType; } // Forward declaration of `UnifiedRiveEvent` to properly resolve imports. namespace margelo::nitro::rive { struct UnifiedRiveEvent; } // Forward declaration of `RiveEventType` to properly resolve imports. @@ -39,9 +43,11 @@ namespace margelo::nitro::rive { enum class RiveEventType; } #include "DataBindMode.hpp" #include "DataBindByName.hpp" #include +#include "RiveError.hpp" +#include +#include "RiveErrorType.hpp" #include #include "UnifiedRiveEvent.hpp" -#include #include "RiveEventType.hpp" #include @@ -141,6 +147,13 @@ namespace margelo::nitro::rive { inline void setDataBind(const std::optional, DataBindMode, DataBindByName>>& dataBind) noexcept override { _swiftPart.setDataBind(dataBind); } + inline std::function getOnError() noexcept override { + auto __result = _swiftPart.getOnError(); + return __result; + } + inline void setOnError(const std::function& onError) noexcept override { + _swiftPart.setOnError(onError); + } public: // Methods diff --git a/nitrogen/generated/ios/c++/views/HybridRiveViewComponent.mm b/nitrogen/generated/ios/c++/views/HybridRiveViewComponent.mm index 0c4d01bd..912bd2ca 100644 --- a/nitrogen/generated/ios/c++/views/HybridRiveViewComponent.mm +++ b/nitrogen/generated/ios/c++/views/HybridRiveViewComponent.mm @@ -111,6 +111,11 @@ - (void) updateProps:(const std::shared_ptr&)props swiftPart.setDataBind(newViewProps.dataBind.value); newViewProps.dataBind.isDirty = false; } + // onError: function + if (newViewProps.onError.isDirty) { + swiftPart.setOnError(newViewProps.onError.value); + newViewProps.onError.isDirty = false; + } swiftPart.afterUpdate(); diff --git a/nitrogen/generated/ios/swift/Func_void_RiveError.swift b/nitrogen/generated/ios/swift/Func_void_RiveError.swift new file mode 100644 index 00000000..3d6af09a --- /dev/null +++ b/nitrogen/generated/ios/swift/Func_void_RiveError.swift @@ -0,0 +1,47 @@ +/// +/// Func_void_RiveError.swift +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © 2025 Marc Rousavy @ Margelo +/// + +import NitroModules + + +/** + * Wraps a Swift `(_ error: RiveError) -> Void` as a class. + * This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`. + */ +public final class Func_void_RiveError { + public typealias bridge = margelo.nitro.rive.bridge.swift + + private let closure: (_ error: RiveError) -> Void + + public init(_ closure: @escaping (_ error: RiveError) -> Void) { + self.closure = closure + } + + @inline(__always) + public func call(error: RiveError) -> Void { + self.closure(error) + } + + /** + * Casts this instance to a retained unsafe raw pointer. + * This acquires one additional strong reference on the object! + */ + @inline(__always) + public func toUnsafe() -> UnsafeMutableRawPointer { + return Unmanaged.passRetained(self).toOpaque() + } + + /** + * Casts an unsafe pointer to a `Func_void_RiveError`. + * The pointer has to be a retained opaque `Unmanaged`. + * This removes one strong reference from the object! + */ + @inline(__always) + public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_RiveError { + return Unmanaged.fromOpaque(pointer).takeRetainedValue() + } +} diff --git a/nitrogen/generated/ios/swift/HybridRiveViewSpec.swift b/nitrogen/generated/ios/swift/HybridRiveViewSpec.swift index 8e4520d2..a4ba5ba6 100644 --- a/nitrogen/generated/ios/swift/HybridRiveViewSpec.swift +++ b/nitrogen/generated/ios/swift/HybridRiveViewSpec.swift @@ -20,6 +20,7 @@ public protocol HybridRiveViewSpec_protocol: HybridObject, HybridView { var fit: Fit? { get set } var layoutScaleFactor: Double? { get set } var dataBind: Variant__any_HybridViewModelInstanceSpec__DataBindMode_DataBindByName? { get set } + var onError: (_ error: RiveError) -> Void { get set } // Methods func awaitViewReady() throws -> Promise diff --git a/nitrogen/generated/ios/swift/HybridRiveViewSpec_cxx.swift b/nitrogen/generated/ios/swift/HybridRiveViewSpec_cxx.swift index aad03ff9..5c25e9a8 100644 --- a/nitrogen/generated/ios/swift/HybridRiveViewSpec_cxx.swift +++ b/nitrogen/generated/ios/swift/HybridRiveViewSpec_cxx.swift @@ -310,6 +310,25 @@ open class HybridRiveViewSpec_cxx { }() } } + + public final var onError: bridge.Func_void_RiveError { + @inline(__always) + get { + return { () -> bridge.Func_void_RiveError in + let __closureWrapper = Func_void_RiveError(self.__implementation.onError) + return bridge.create_Func_void_RiveError(__closureWrapper.toUnsafe()) + }() + } + @inline(__always) + set { + self.__implementation.onError = { () -> (RiveError) -> Void in + let __wrappedFunction = bridge.wrap_Func_void_RiveError(newValue) + return { (__error: RiveError) -> Void in + __wrappedFunction.call(__error) + } + }() + } + } // Methods @inline(__always) diff --git a/nitrogen/generated/ios/swift/RiveError.swift b/nitrogen/generated/ios/swift/RiveError.swift new file mode 100644 index 00000000..36b146ba --- /dev/null +++ b/nitrogen/generated/ios/swift/RiveError.swift @@ -0,0 +1,46 @@ +/// +/// RiveError.swift +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © 2025 Marc Rousavy @ Margelo +/// + +import NitroModules + +/** + * Represents an instance of `RiveError`, backed by a C++ struct. + */ +public typealias RiveError = margelo.nitro.rive.RiveError + +public extension RiveError { + private typealias bridge = margelo.nitro.rive.bridge.swift + + /** + * Create a new instance of `RiveError`. + */ + init(message: String, type: RiveErrorType) { + self.init(std.string(message), type) + } + + var message: String { + @inline(__always) + get { + return String(self.__message) + } + @inline(__always) + set { + self.__message = std.string(newValue) + } + } + + var type: RiveErrorType { + @inline(__always) + get { + return self.__type + } + @inline(__always) + set { + self.__type = newValue + } + } +} diff --git a/nitrogen/generated/ios/swift/RiveErrorType.swift b/nitrogen/generated/ios/swift/RiveErrorType.swift new file mode 100644 index 00000000..fc03bb7b --- /dev/null +++ b/nitrogen/generated/ios/swift/RiveErrorType.swift @@ -0,0 +1,64 @@ +/// +/// RiveErrorType.swift +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © 2025 Marc Rousavy @ Margelo +/// + +/** + * Represents the JS enum `RiveErrorType`, backed by a C++ enum. + */ +public typealias RiveErrorType = margelo.nitro.rive.RiveErrorType + +public extension RiveErrorType { + /** + * Get a RiveErrorType for the given String value, or + * return `nil` if the given value was invalid/unknown. + */ + init?(fromString string: String) { + switch string { + case "Unknown": + self = .unknown + case "FileNotFound": + self = .filenotfound + case "MalformedFile": + self = .malformedfile + case "IncorrectArtboardName": + self = .incorrectartboardname + case "IncorrectStateMachineName": + self = .incorrectstatemachinename + case "IncorrectAnimationName": + self = .incorrectanimationname + case "DataBindingError": + self = .databindingerror + case "TextRunNotFoundError": + self = .textrunnotfounderror + default: + return nil + } + } + + /** + * Get the String value this RiveErrorType represents. + */ + var stringValue: String { + switch self { + case .unknown: + return "Unknown" + case .filenotfound: + return "FileNotFound" + case .malformedfile: + return "MalformedFile" + case .incorrectartboardname: + return "IncorrectArtboardName" + case .incorrectstatemachinename: + return "IncorrectStateMachineName" + case .incorrectanimationname: + return "IncorrectAnimationName" + case .databindingerror: + return "DataBindingError" + case .textrunnotfounderror: + return "TextRunNotFoundError" + } + } +} diff --git a/nitrogen/generated/shared/c++/HybridRiveViewSpec.cpp b/nitrogen/generated/shared/c++/HybridRiveViewSpec.cpp index 5f347257..05e959f2 100644 --- a/nitrogen/generated/shared/c++/HybridRiveViewSpec.cpp +++ b/nitrogen/generated/shared/c++/HybridRiveViewSpec.cpp @@ -30,6 +30,8 @@ namespace margelo::nitro::rive { prototype.registerHybridSetter("layoutScaleFactor", &HybridRiveViewSpec::setLayoutScaleFactor); prototype.registerHybridGetter("dataBind", &HybridRiveViewSpec::getDataBind); prototype.registerHybridSetter("dataBind", &HybridRiveViewSpec::setDataBind); + prototype.registerHybridGetter("onError", &HybridRiveViewSpec::getOnError); + prototype.registerHybridSetter("onError", &HybridRiveViewSpec::setOnError); prototype.registerHybridMethod("awaitViewReady", &HybridRiveViewSpec::awaitViewReady); prototype.registerHybridMethod("bindViewModelInstance", &HybridRiveViewSpec::bindViewModelInstance); prototype.registerHybridMethod("getViewModelInstance", &HybridRiveViewSpec::getViewModelInstance); diff --git a/nitrogen/generated/shared/c++/HybridRiveViewSpec.hpp b/nitrogen/generated/shared/c++/HybridRiveViewSpec.hpp index c4d4b0be..0bf16814 100644 --- a/nitrogen/generated/shared/c++/HybridRiveViewSpec.hpp +++ b/nitrogen/generated/shared/c++/HybridRiveViewSpec.hpp @@ -25,6 +25,8 @@ namespace margelo::nitro::rive { class HybridViewModelInstanceSpec; } namespace margelo::nitro::rive { enum class DataBindMode; } // Forward declaration of `DataBindByName` to properly resolve imports. namespace margelo::nitro::rive { struct DataBindByName; } +// Forward declaration of `RiveError` to properly resolve imports. +namespace margelo::nitro::rive { struct RiveError; } // Forward declaration of `UnifiedRiveEvent` to properly resolve imports. namespace margelo::nitro::rive { struct UnifiedRiveEvent; } @@ -38,9 +40,10 @@ namespace margelo::nitro::rive { struct UnifiedRiveEvent; } #include "DataBindMode.hpp" #include "DataBindByName.hpp" #include +#include "RiveError.hpp" +#include #include #include "UnifiedRiveEvent.hpp" -#include namespace margelo::nitro::rive { @@ -85,6 +88,8 @@ namespace margelo::nitro::rive { virtual void setLayoutScaleFactor(std::optional layoutScaleFactor) = 0; virtual std::optional, DataBindMode, DataBindByName>> getDataBind() = 0; virtual void setDataBind(const std::optional, DataBindMode, DataBindByName>>& dataBind) = 0; + virtual std::function getOnError() = 0; + virtual void setOnError(const std::function& onError) = 0; public: // Methods diff --git a/nitrogen/generated/shared/c++/RiveError.hpp b/nitrogen/generated/shared/c++/RiveError.hpp new file mode 100644 index 00000000..f798ac64 --- /dev/null +++ b/nitrogen/generated/shared/c++/RiveError.hpp @@ -0,0 +1,81 @@ +/// +/// RiveError.hpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © 2025 Marc Rousavy @ Margelo +/// + +#pragma once + +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif + +// Forward declaration of `RiveErrorType` to properly resolve imports. +namespace margelo::nitro::rive { enum class RiveErrorType; } + +#include +#include "RiveErrorType.hpp" + +namespace margelo::nitro::rive { + + /** + * A struct which can be represented as a JavaScript object (RiveError). + */ + struct RiveError { + public: + std::string message SWIFT_PRIVATE; + RiveErrorType type SWIFT_PRIVATE; + + public: + RiveError() = default; + explicit RiveError(std::string message, RiveErrorType type): message(message), type(type) {} + }; + +} // namespace margelo::nitro::rive + +namespace margelo::nitro { + + // C++ RiveError <> JS RiveError (object) + template <> + struct JSIConverter final { + static inline margelo::nitro::rive::RiveError fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { + jsi::Object obj = arg.asObject(runtime); + return margelo::nitro::rive::RiveError( + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, "message")), + JSIConverter::fromJSI(runtime, obj.getProperty(runtime, "type")) + ); + } + static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::rive::RiveError& arg) { + jsi::Object obj(runtime); + obj.setProperty(runtime, "message", JSIConverter::toJSI(runtime, arg.message)); + obj.setProperty(runtime, "type", JSIConverter::toJSI(runtime, arg.type)); + return obj; + } + static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) { + if (!value.isObject()) { + return false; + } + jsi::Object obj = value.getObject(runtime); + if (!nitro::isPlainObject(runtime, obj)) { + return false; + } + if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, "message"))) return false; + if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, "type"))) return false; + return true; + } + }; + +} // namespace margelo::nitro diff --git a/nitrogen/generated/shared/c++/RiveErrorType.hpp b/nitrogen/generated/shared/c++/RiveErrorType.hpp new file mode 100644 index 00000000..d5cf1f69 --- /dev/null +++ b/nitrogen/generated/shared/c++/RiveErrorType.hpp @@ -0,0 +1,68 @@ +/// +/// RiveErrorType.hpp +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © 2025 Marc Rousavy @ Margelo +/// + +#pragma once + +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif +#if __has_include() +#include +#else +#error NitroModules cannot be found! Are you sure you installed NitroModules properly? +#endif + +namespace margelo::nitro::rive { + + /** + * An enum which can be represented as a JavaScript enum (RiveErrorType). + */ + enum class RiveErrorType { + UNKNOWN SWIFT_NAME(unknown) = 0, + FILENOTFOUND SWIFT_NAME(filenotfound) = 1, + MALFORMEDFILE SWIFT_NAME(malformedfile) = 2, + INCORRECTARTBOARDNAME SWIFT_NAME(incorrectartboardname) = 3, + INCORRECTSTATEMACHINENAME SWIFT_NAME(incorrectstatemachinename) = 4, + INCORRECTANIMATIONNAME SWIFT_NAME(incorrectanimationname) = 5, + DATABINDINGERROR SWIFT_NAME(databindingerror) = 6, + TEXTRUNNOTFOUNDERROR SWIFT_NAME(textrunnotfounderror) = 7, + } CLOSED_ENUM; + +} // namespace margelo::nitro::rive + +namespace margelo::nitro { + + // C++ RiveErrorType <> JS RiveErrorType (enum) + template <> + struct JSIConverter final { + static inline margelo::nitro::rive::RiveErrorType fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { + int enumValue = JSIConverter::fromJSI(runtime, arg); + return static_cast(enumValue); + } + static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::rive::RiveErrorType arg) { + int enumValue = static_cast(arg); + return JSIConverter::toJSI(runtime, enumValue); + } + static inline bool canConvert(jsi::Runtime&, const jsi::Value& value) { + if (!value.isNumber()) { + return false; + } + double number = value.getNumber(); + int integer = static_cast(number); + if (number != integer) { + // The integer is not the same value as the double - we truncated floating points. + // Enums are all integers, so the input floating point number is obviously invalid. + return false; + } + // Check if we are within the bounds of the enum. + return integer >= 0 && integer <= 7; + } + }; + +} // namespace margelo::nitro diff --git a/nitrogen/generated/shared/c++/views/HybridRiveViewComponent.cpp b/nitrogen/generated/shared/c++/views/HybridRiveViewComponent.cpp index 0d9069d6..c1edd20a 100644 --- a/nitrogen/generated/shared/c++/views/HybridRiveViewComponent.cpp +++ b/nitrogen/generated/shared/c++/views/HybridRiveViewComponent.cpp @@ -105,6 +105,16 @@ namespace margelo::nitro::rive::views { throw std::runtime_error(std::string("RiveView.dataBind: ") + exc.what()); } }()), + onError([&]() -> CachedProp> { + try { + const react::RawValue* rawValue = rawProps.at("onError", nullptr, nullptr); + if (rawValue == nullptr) return sourceProps.onError; + const auto& [runtime, value] = (std::pair)*rawValue; + return CachedProp>::fromRawValue(*runtime, value.asObject(*runtime).getProperty(*runtime, "f"), sourceProps.onError); + } catch (const std::exception& exc) { + throw std::runtime_error(std::string("RiveView.onError: ") + exc.what()); + } + }()), hybridRef([&]() -> CachedProp& /* ref */)>>> { try { const react::RawValue* rawValue = rawProps.at("hybridRef", nullptr, nullptr); @@ -126,6 +136,7 @@ namespace margelo::nitro::rive::views { fit(other.fit), layoutScaleFactor(other.layoutScaleFactor), dataBind(other.dataBind), + onError(other.onError), hybridRef(other.hybridRef) { } bool HybridRiveViewProps::filterObjectKeys(const std::string& propName) { @@ -138,6 +149,7 @@ namespace margelo::nitro::rive::views { case hashString("fit"): return true; case hashString("layoutScaleFactor"): return true; case hashString("dataBind"): return true; + case hashString("onError"): return true; case hashString("hybridRef"): return true; default: return false; } diff --git a/nitrogen/generated/shared/c++/views/HybridRiveViewComponent.hpp b/nitrogen/generated/shared/c++/views/HybridRiveViewComponent.hpp index 664315c3..1ea801c1 100644 --- a/nitrogen/generated/shared/c++/views/HybridRiveViewComponent.hpp +++ b/nitrogen/generated/shared/c++/views/HybridRiveViewComponent.hpp @@ -26,8 +26,9 @@ #include "DataBindMode.hpp" #include "DataBindByName.hpp" #include -#include "HybridRiveViewSpec.hpp" +#include "RiveError.hpp" #include +#include "HybridRiveViewSpec.hpp" namespace margelo::nitro::rive::views { @@ -58,6 +59,7 @@ namespace margelo::nitro::rive::views { CachedProp> fit; CachedProp> layoutScaleFactor; CachedProp, DataBindMode, DataBindByName>>> dataBind; + CachedProp> onError; CachedProp& /* ref */)>>> hybridRef; private: diff --git a/nitrogen/generated/shared/json/RiveViewConfig.json b/nitrogen/generated/shared/json/RiveViewConfig.json index 19eab869..8eab6292 100644 --- a/nitrogen/generated/shared/json/RiveViewConfig.json +++ b/nitrogen/generated/shared/json/RiveViewConfig.json @@ -12,6 +12,7 @@ "fit": true, "layoutScaleFactor": true, "dataBind": true, + "onError": true, "hybridRef": true } } diff --git a/src/core/Errors.ts b/src/core/Errors.ts new file mode 100644 index 00000000..62a2358a --- /dev/null +++ b/src/core/Errors.ts @@ -0,0 +1,15 @@ +export enum RiveErrorType { + Unknown = 0, + FileNotFound = 1, + MalformedFile = 2, + IncorrectArtboardName = 3, + IncorrectStateMachineName = 4, + IncorrectAnimationName = 5, + DataBindingError = 6, + TextRunNotFoundError = 7, +} + +export interface RiveError { + message: string; + type: RiveErrorType; +} diff --git a/src/core/RiveView.tsx b/src/core/RiveView.tsx new file mode 100644 index 00000000..7812caf3 --- /dev/null +++ b/src/core/RiveView.tsx @@ -0,0 +1,47 @@ +import type { ComponentProps } from 'react'; +import { NitroRiveView } from 'react-native-rive'; +import type { RiveError } from './Errors'; + +export interface RiveViewProps + extends Omit, 'onError'> { + onError?: (error: RiveError) => void; +} + +const defaultOnError = (error: RiveError) => console.error(error.message); + +/** + * RiveView is a React Native component that renders Rive graphics. + * It provides a seamless way to display and control Rive graphics in your app. + * + * @example + * ```tsx + * + * ``` + * + * @property {RiveFile} file - The Rive file to be displayed + * @property {string} [artboardName] - Name of the artboard to display from the Rive file + * @property {string} [stateMachineName] - Name of the state machine to play + * @property {ViewModelInstance | DataBindMode | DataBindByName} [dataBind] - Data binding configuration for the state machine + * @property {boolean} [autoPlay=true] - Whether to automatically start playing the state machine + * @property {Alignment} [alignment] - How the Rive graphic should be aligned within its container + * @property {Fit} [fit] - How the Rive graphic should fit within its container + * @property {Object} [style] - React Native style object for container customization + * @property {(error: RiveError) => void} [onError] - Callback function that is called when an error occurs + * + * The component also exposes methods for controlling playback: + * - play(): Starts playing the Rive graphic + * - pause(): Pauses the Rive graphic + */ +export function RiveView(props: RiveViewProps) { + const { onError, ...rest } = props; + const wrappedOnError = onError ?? defaultOnError; + + return ; +} diff --git a/src/hooks/useRive.ts b/src/hooks/useRive.ts index a634381b..26c3af6a 100644 --- a/src/hooks/useRive.ts +++ b/src/hooks/useRive.ts @@ -1,57 +1,50 @@ import { useRef, useCallback, useState } from 'react'; -import type { HybridView } from 'react-native-nitro-modules'; -import type { RiveViewProps, RiveViewMethods } from 'react-native-rive'; +import type { RiveViewRef } from 'react-native-rive'; export function useRive() { - const riveRef = useRef>(null); - const [riveViewRef, setRiveViewRef] = useState | null>(null); + const riveRef = useRef(null); + const [riveViewRef, setRiveViewRef] = useState(null); const timeoutRef = useRef | null>(null); - const setRef = useCallback( - (node: HybridView | null) => { - if (riveRef.current !== node) { - riveRef.current = node; + const setRef = useCallback((node: RiveViewRef | null) => { + if (riveRef.current !== node) { + riveRef.current = node; - // Clear any existing timeout - if (timeoutRef.current) { - clearTimeout(timeoutRef.current); - } + // Clear any existing timeout + if (timeoutRef.current) { + clearTimeout(timeoutRef.current); + } - const timeout = new Promise((_, reject) => { - timeoutRef.current = setTimeout(() => { - reject(new Error('Rive view ready timeout')); - }, 5000); - }); + const timeout = new Promise((_, reject) => { + timeoutRef.current = setTimeout(() => { + reject(new Error('Rive view ready timeout')); + }, 5000); + }); - // TODO: Need to clear out the awaitViewReady promise if it times out - // or add this timeout natively and return false - Promise.race([node?.awaitViewReady(), timeout]) - .then((result) => { - if (result === true) { - setRiveViewRef(node); - } else { - console.warn('Rive view ready check returned false'); - setRiveViewRef(null); - } - }) - .catch((error) => { - console.warn('Failed to initialize Rive view:', error); + // TODO: Need to clear out the awaitViewReady promise if it times out + // or add this timeout natively and return false + Promise.race([node?.awaitViewReady(), timeout]) + .then((result) => { + if (result === true) { + setRiveViewRef(node); + } else { + console.warn('Rive view ready check returned false'); setRiveViewRef(null); - }) - .finally(() => { - // Clear the timeout in both success and error cases - if (timeoutRef.current) { - clearTimeout(timeoutRef.current); - timeoutRef.current = null; - } - }); - } - }, - [] - ); + } + }) + .catch((error) => { + console.warn('Failed to initialize Rive view:', error); + setRiveViewRef(null); + }) + .finally(() => { + // Clear the timeout in both success and error cases + if (timeoutRef.current) { + clearTimeout(timeoutRef.current); + timeoutRef.current = null; + } + }); + } + }, []); return { riveRef, diff --git a/src/index.tsx b/src/index.tsx index 7b8bdf1a..f1be4f5f 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -2,12 +2,13 @@ import { getHostComponent, NitroModules, type ReactNativeView, + type HybridView, } from 'react-native-nitro-modules'; import type { Rive } from './specs/Rive.nitro'; import { type RiveViewMethods, type RiveViewTSMethods, - type RiveViewProps, + type RiveViewProps as NativeRiveViewProps, DataBindMode, type DataBindByName as DataBindByNameInterface, } from './specs/RiveView.nitro'; @@ -27,41 +28,24 @@ export function multiply(a: number, b: number): number { return RiveHybridObject.multiply(a, b); } -/** - * RiveView is a React Native component that renders Rive graphics. - * It provides a seamless way to display and control Rive graphics in your app. - * - * @example - * ```tsx - * - * ``` - * - * @property {RiveFile} file - The Rive file to be displayed - * @property {string} [artboardName] - Name of the artboard to display from the Rive file - * @property {string} [stateMachineName] - Name of the state machine to play - * @property {boolean} [autoBind=true] - Whether to automatically bind the state machine and artboard - * @property {boolean} [autoPlay=true] - Whether to automatically start playing the state machine - * @property {Alignment} [alignment] - How the Rive graphic should be aligned within its container - * @property {Fit} [fit] - How the Rive graphic should fit within its container - * @property {Object} [style] - React Native style object for container customization - * - * The component also exposes methods for controlling playback: - * - play(): Starts playing the Rive graphic - * - pause(): Pauses the Rive graphic - */ -export const RiveView = getHostComponent( - 'RiveView', - () => RiveViewConfig -) as ReactNativeView; +type NativeRiveViewPropsInternal = Omit & { + onError: { f: (message: string) => void }; +}; -export type { RiveViewProps, RiveViewMethods }; +export const NitroRiveView = getHostComponent< + NativeRiveViewPropsInternal, + RiveViewMethods +>('RiveView', () => RiveViewConfig) as ReactNativeView< + NativeRiveViewPropsInternal, + RiveViewTSMethods +>; + +export { RiveView, type RiveViewProps } from './core/RiveView'; +export type { RiveViewMethods }; +export type RiveViewRef = HybridView< + NativeRiveViewPropsInternal, + RiveViewTSMethods +>; export type { RiveFile } from './specs/RiveFile.nitro'; export type { ViewModel, @@ -78,6 +62,7 @@ export { Alignment } from './core/Alignment'; export { RiveFileFactory } from './core/RiveFile'; export { RiveColor } from './core/RiveColor'; export { type RiveEvent, RiveEventType } from './core/Events'; +export { type RiveError, RiveErrorType } from './core/Errors'; export { ArtboardByIndex, ArtboardByName } from './specs/ArtboardBy'; export { useRive } from './hooks/useRive'; export { useRiveNumber } from './hooks/useRiveNumber'; diff --git a/src/specs/RiveView.nitro.ts b/src/specs/RiveView.nitro.ts index 9f0a1baf..6625f6d9 100644 --- a/src/specs/RiveView.nitro.ts +++ b/src/specs/RiveView.nitro.ts @@ -8,6 +8,7 @@ import { Fit } from '../core/Fit'; import type { ViewModelInstance } from './ViewModel.nitro'; import type { Alignment } from '../core/Alignment'; import type { UnifiedRiveEvent, RiveEvent } from '../core/Events'; +import type { RiveError } from '../core/Errors'; export enum DataBindMode { Auto, @@ -38,6 +39,8 @@ export interface RiveViewProps extends HybridViewProps { layoutScaleFactor?: number; /** The view model instance to bind, to the state machine. Defaults to DataBindMode.Auto */ dataBind?: ViewModelInstance | DataBindMode | DataBindByName; + /** Callback function that is called when an error occurs */ + onError: (error: RiveError) => void; } /** From 7e87925e553a09c7a798b0be003c71cb19b2d74b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mikl=C3=B3s=20Fazekas?= Date: Wed, 19 Nov 2025 08:16:55 +0100 Subject: [PATCH 2/9] detectErrorType --- .../com/margelo/nitro/rive/HybridRiveView.kt | 19 ++++++----- ios/HybridRiveView.swift | 32 +++++++++++-------- 2 files changed, 28 insertions(+), 23 deletions(-) diff --git a/android/src/main/java/com/margelo/nitro/rive/HybridRiveView.kt b/android/src/main/java/com/margelo/nitro/rive/HybridRiveView.kt index b2120eab..5487568b 100644 --- a/android/src/main/java/com/margelo/nitro/rive/HybridRiveView.kt +++ b/android/src/main/java/com/margelo/nitro/rive/HybridRiveView.kt @@ -10,6 +10,7 @@ import com.rive.RiveReactNativeView import com.rive.ViewConfiguration import app.rive.runtime.kotlin.core.Fit as RiveFit import app.rive.runtime.kotlin.core.Alignment as RiveAlignment +import app.rive.runtime.kotlin.core.errors.* import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext @@ -225,16 +226,14 @@ class HybridRiveView(val context: ThemedReactContext) : HybridRiveViewSpec() { } private fun detectErrorType(exception: Exception): RiveErrorType { - val errorMessage = exception.message?.lowercase() ?: "" - - return when { - errorMessage.contains("artboard") -> RiveErrorType.INCORRECTARTBOARDNAME - errorMessage.contains("state machine") -> RiveErrorType.INCORRECTSTATEMACHINENAME - errorMessage.contains("animation") -> RiveErrorType.INCORRECTANIMATIONNAME - errorMessage.contains("data binding") || errorMessage.contains("databinding") -> RiveErrorType.DATABINDINGERROR - errorMessage.contains("text run") -> RiveErrorType.TEXTRUNNOTFOUNDERROR - errorMessage.contains("file") || errorMessage.contains("not found") -> RiveErrorType.FILENOTFOUND - errorMessage.contains("malformed") || errorMessage.contains("corrupt") -> RiveErrorType.MALFORMEDFILE + return when (exception) { + is ArtboardException -> RiveErrorType.INCORRECTARTBOARDNAME + is StateMachineException -> RiveErrorType.INCORRECTSTATEMACHINENAME + is AnimationException -> RiveErrorType.INCORRECTANIMATIONNAME + is MalformedFileException -> RiveErrorType.MALFORMEDFILE + is StateMachineInputException -> RiveErrorType.INCORRECTANIMATIONNAME + is TextValueRunException -> RiveErrorType.TEXTRUNNOTFOUNDERROR + is ViewModelException -> RiveErrorType.DATABINDINGERROR else -> RiveErrorType.UNKNOWN } } diff --git a/ios/HybridRiveView.swift b/ios/HybridRiveView.swift index 31de9b79..e08b76e0 100644 --- a/ios/HybridRiveView.swift +++ b/ios/HybridRiveView.swift @@ -199,30 +199,36 @@ extension HybridRiveView { let riveError = RiveError( message: errorMessage, - type: errorType, + type: errorType ) onError(riveError) } } private func detectErrorType(_ error: Error) -> RiveErrorType { - let errorDescription = String(describing: error).lowercased() + let nsError = error as NSError + guard let errorName = nsError.userInfo["name"] as? String else { + return .unknown + } - if errorDescription.contains("artboard") { + switch errorName { + case "NoArtboardFound": return .incorrectartboardname - } else if errorDescription.contains("state machine") { + case "NoStateMachineFound": return .incorrectstatemachinename - } else if errorDescription.contains("animation") { + case "NoAnimationFound": return .incorrectanimationname - } else if errorDescription.contains("data binding") || errorDescription.contains("databinding") { - return .databindingerror - } else if errorDescription.contains("text run") { - return .textrunnotfounderror - } else if errorDescription.contains("file") || errorDescription.contains("not found") { - return .filenotfound - } else if errorDescription.contains("malformed") || errorDescription.contains("corrupt") { + case "Malformed": return .malformedfile - } else { + case "FileNotFound": + return .filenotfound + case "NoStateMachineInputFound": + return .incorrectanimationname + case "TextRunNotFoundError": + return .textrunnotfounderror + case "DataBindingError": + return .databindingerror + default: return .unknown } } From 84ac9b5b380f28df68a4c5ddde641643274b209a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mikl=C3=B3s=20Fazekas?= Date: Wed, 19 Nov 2025 10:59:40 +0100 Subject: [PATCH 3/9] fix: error types onError callback --- .../com/margelo/nitro/rive/HybridRiveView.kt | 2 +- ios/HybridRiveView.swift | 4 ++++ src/core/RiveView.tsx | 11 ++++++----- src/index.tsx | 19 +++---------------- 4 files changed, 14 insertions(+), 22 deletions(-) diff --git a/android/src/main/java/com/margelo/nitro/rive/HybridRiveView.kt b/android/src/main/java/com/margelo/nitro/rive/HybridRiveView.kt index 5487568b..682df525 100644 --- a/android/src/main/java/com/margelo/nitro/rive/HybridRiveView.kt +++ b/android/src/main/java/com/margelo/nitro/rive/HybridRiveView.kt @@ -231,7 +231,7 @@ class HybridRiveView(val context: ThemedReactContext) : HybridRiveViewSpec() { is StateMachineException -> RiveErrorType.INCORRECTSTATEMACHINENAME is AnimationException -> RiveErrorType.INCORRECTANIMATIONNAME is MalformedFileException -> RiveErrorType.MALFORMEDFILE - is StateMachineInputException -> RiveErrorType.INCORRECTANIMATIONNAME + is StateMachineInputException -> RiveErrorType.INCORRECTSTATEMACHINEINPUTNAME is TextValueRunException -> RiveErrorType.TEXTRUNNOTFOUNDERROR is ViewModelException -> RiveErrorType.DATABINDINGERROR else -> RiveErrorType.UNKNOWN diff --git a/ios/HybridRiveView.swift b/ios/HybridRiveView.swift index e08b76e0..7e0c2355 100644 --- a/ios/HybridRiveView.swift +++ b/ios/HybridRiveView.swift @@ -206,6 +206,10 @@ extension HybridRiveView { } private func detectErrorType(_ error: Error) -> RiveErrorType { + if case NativeRiveError.instanceNotFound = error { + return .databindingerror + } + let nsError = error as NSError guard let errorName = nsError.userInfo["name"] as? String else { return .unknown diff --git a/src/core/RiveView.tsx b/src/core/RiveView.tsx index 7812caf3..e988a4b5 100644 --- a/src/core/RiveView.tsx +++ b/src/core/RiveView.tsx @@ -1,13 +1,14 @@ import type { ComponentProps } from 'react'; -import { NitroRiveView } from 'react-native-rive'; -import type { RiveError } from './Errors'; +import { NitroRiveView } from '../index'; +import { RiveErrorType, type RiveError } from './Errors'; export interface RiveViewProps extends Omit, 'onError'> { onError?: (error: RiveError) => void; } -const defaultOnError = (error: RiveError) => console.error(error.message); +const defaultOnError = (error: RiveError) => + console.error(`[${RiveErrorType[error.type]}] ${error.message}`); /** * RiveView is a React Native component that renders Rive graphics. @@ -28,7 +29,7 @@ const defaultOnError = (error: RiveError) => console.error(error.message); * @property {RiveFile} file - The Rive file to be displayed * @property {string} [artboardName] - Name of the artboard to display from the Rive file * @property {string} [stateMachineName] - Name of the state machine to play - * @property {ViewModelInstance | DataBindMode | DataBindByName} [dataBind] - Data binding configuration for the state machine + * @property {ViewModelInstance | DataBindMode | DataBindByName} [dataBind] - Data binding configuration for the state machine, defaults to DataBindMode.Auto * @property {boolean} [autoPlay=true] - Whether to automatically start playing the state machine * @property {Alignment} [alignment] - How the Rive graphic should be aligned within its container * @property {Fit} [fit] - How the Rive graphic should fit within its container @@ -43,5 +44,5 @@ export function RiveView(props: RiveViewProps) { const { onError, ...rest } = props; const wrappedOnError = onError ?? defaultOnError; - return ; + return ; } diff --git a/src/index.tsx b/src/index.tsx index f1be4f5f..63832fd1 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -22,30 +22,17 @@ export class DataBindByName implements DataBindByNameInterface { import RiveViewConfig from '../nitrogen/generated/shared/json/RiveViewConfig.json'; -const RiveHybridObject = NitroModules.createHybridObject('Rive'); - -export function multiply(a: number, b: number): number { - return RiveHybridObject.multiply(a, b); -} - -type NativeRiveViewPropsInternal = Omit & { - onError: { f: (message: string) => void }; -}; - export const NitroRiveView = getHostComponent< - NativeRiveViewPropsInternal, + NativeRiveViewProps, RiveViewMethods >('RiveView', () => RiveViewConfig) as ReactNativeView< - NativeRiveViewPropsInternal, + NativeRiveViewProps, RiveViewTSMethods >; export { RiveView, type RiveViewProps } from './core/RiveView'; export type { RiveViewMethods }; -export type RiveViewRef = HybridView< - NativeRiveViewPropsInternal, - RiveViewTSMethods ->; +export type RiveViewRef = HybridView; export type { RiveFile } from './specs/RiveFile.nitro'; export type { ViewModel, From 780479fb22b48084245927630da668e2bd05070d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mikl=C3=B3s=20Fazekas?= Date: Wed, 19 Nov 2025 12:18:37 +0100 Subject: [PATCH 4/9] fix: improve error handling and fix import cycle MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Fix import cycle by extracting NitroRiveView to separate file - Make error types human-readable in logs (show enum names instead of numbers) - Improve iOS error detection using RiveErrorCode enum values instead of string comparisons - Rename NativeRiveError to NitroRiveError for consistency with Nitro Modules naming - Make detectErrorType return tuple with both error type and message - Add NitroRiveError.fileNotFound case for asset loading errors - Remove non-existent error types (TextRunNotFoundError, IncorrectAnimationName) - Map instanceNotFound errors to DataBindingError type 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- ios/HybridRiveView.swift | 53 +++++++++++++++--------------- ios/ReferencedAssetLoader.swift | 12 +++---- ios/RiveReactNativeView.swift | 5 +-- src/core/Errors.ts | 2 -- src/core/NitroRiveViewComponent.ts | 18 ++++++++++ src/core/RiveView.tsx | 2 +- src/index.tsx | 18 ++-------- 7 files changed, 54 insertions(+), 56 deletions(-) create mode 100644 src/core/NitroRiveViewComponent.ts diff --git a/ios/HybridRiveView.swift b/ios/HybridRiveView.swift index 7e0c2355..bd9c16a2 100644 --- a/ios/HybridRiveView.swift +++ b/ios/HybridRiveView.swift @@ -194,8 +194,9 @@ extension HybridRiveView { do { return try fn() } catch (let e) { - let errorType = detectErrorType(e) - let errorMessage = "[RIVE] \(tag) \(note ?? "") \(e)" + let (errorType, errorDescription) = detectErrorType(e) + let noteString = note.map { " \($0)" } ?? "" + let errorMessage = "[RIVE] \(tag)\(noteString) \(errorDescription)" let riveError = RiveError( message: errorMessage, @@ -205,35 +206,33 @@ extension HybridRiveView { } } - private func detectErrorType(_ error: Error) -> RiveErrorType { - if case NativeRiveError.instanceNotFound = error { - return .databindingerror + private func detectErrorType(_ error: Error) -> (RiveErrorType, String) { + switch error { + case NitroRiveError.instanceNotFound(let message): + return (.databindingerror, message) + case NitroRiveError.fileNotFound(let message): + return (.filenotfound, message) + default: + break } let nsError = error as NSError - guard let errorName = nsError.userInfo["name"] as? String else { - return .unknown - } - - switch errorName { - case "NoArtboardFound": - return .incorrectartboardname - case "NoStateMachineFound": - return .incorrectstatemachinename - case "NoAnimationFound": - return .incorrectanimationname - case "Malformed": - return .malformedfile - case "FileNotFound": - return .filenotfound - case "NoStateMachineInputFound": - return .incorrectanimationname - case "TextRunNotFoundError": - return .textrunnotfounderror - case "DataBindingError": - return .databindingerror + let message = nsError.localizedDescription + + // RiveErrorCode from RiveRuntime + switch nsError.code { + case RiveErrorCode.noArtboardFound.rawValue: + return (.incorrectartboardname, message) + case RiveErrorCode.noStateMachineFound.rawValue: + return (.incorrectstatemachinename, message) + case RiveErrorCode.noAnimationFound.rawValue: + return (.incorrectanimationname, message) + case RiveErrorCode.malformedFile.rawValue: + return (.malformedfile, message) + case RiveErrorCode.noStateMachineInputFound.rawValue: + return (.incorrectanimationname, message) default: - return .unknown + return (.unknown, message) } } } diff --git a/ios/ReferencedAssetLoader.swift b/ios/ReferencedAssetLoader.swift index 0939a524..53828562 100644 --- a/ios/ReferencedAssetLoader.swift +++ b/ios/ReferencedAssetLoader.swift @@ -23,18 +23,14 @@ func createIncorrectRiveURL(_ url: String) -> NSError { ]) } -func createAssetFileError(_ assetName: String) -> NSError { - return NSError( - domain: RiveErrorDomain, code: 801, - userInfo: [ - NSLocalizedDescriptionKey: "Could not load Rive asset: \(assetName)", "name": "FileNotFound", - ]) +func createAssetFileError(_ assetName: String) -> NitroRiveError { + return NitroRiveError.fileNotFound(message: "Could not load Rive asset: \(assetName)") } final class ReferencedAssetLoader { - private func handleRiveError(error: NSError) { + private func handleRiveError(error: Error) { // TODO allow user to specify onError callback - RCTLogError(error.localizedDescription) + RCTLogError("\(error)") } private func handleInvalidUrlError(url: String) { diff --git a/ios/RiveReactNativeView.swift b/ios/RiveReactNativeView.swift index b14b9079..45d49842 100644 --- a/ios/RiveReactNativeView.swift +++ b/ios/RiveReactNativeView.swift @@ -26,8 +26,9 @@ struct ViewConfiguration { let bindData: BindData } -enum NativeRiveError: Error { +enum NitroRiveError: Error { case instanceNotFound(message: String) + case fileNotFound(message: String) } class RiveReactNativeView: UIView, RiveStateMachineDelegate { @@ -110,7 +111,7 @@ class RiveReactNativeView: UIView, RiveStateMachineDelegate { let viewModel = riveFile.defaultViewModel(for: artboard), let instance = viewModel.createInstance(fromName: name) else { - throw NativeRiveError.instanceNotFound(message: "\(name) instance not found") + throw NitroRiveError.instanceNotFound(message: "\(name) instance not found") } stateMachine?.bind(viewModelInstance: instance) // this should be added if we support only playing artboards on their own - https://github.com/rive-app/rive-nitro-react-native/pull/23#discussion_r2534698281 diff --git a/src/core/Errors.ts b/src/core/Errors.ts index 62a2358a..c85efaae 100644 --- a/src/core/Errors.ts +++ b/src/core/Errors.ts @@ -4,9 +4,7 @@ export enum RiveErrorType { MalformedFile = 2, IncorrectArtboardName = 3, IncorrectStateMachineName = 4, - IncorrectAnimationName = 5, DataBindingError = 6, - TextRunNotFoundError = 7, } export interface RiveError { diff --git a/src/core/NitroRiveViewComponent.ts b/src/core/NitroRiveViewComponent.ts new file mode 100644 index 00000000..be594bed --- /dev/null +++ b/src/core/NitroRiveViewComponent.ts @@ -0,0 +1,18 @@ +import { + getHostComponent, + type ReactNativeView, +} from 'react-native-nitro-modules'; +import type { + RiveViewMethods, + RiveViewTSMethods, + RiveViewProps as NativeRiveViewProps, +} from '../specs/RiveView.nitro'; +import RiveViewConfig from '../../nitrogen/generated/shared/json/RiveViewConfig.json'; + +export const NitroRiveView = getHostComponent< + NativeRiveViewProps, + RiveViewMethods +>('RiveView', () => RiveViewConfig) as ReactNativeView< + NativeRiveViewProps, + RiveViewTSMethods +>; diff --git a/src/core/RiveView.tsx b/src/core/RiveView.tsx index e988a4b5..ab09ab89 100644 --- a/src/core/RiveView.tsx +++ b/src/core/RiveView.tsx @@ -1,5 +1,5 @@ import type { ComponentProps } from 'react'; -import { NitroRiveView } from '../index'; +import { NitroRiveView } from './NitroRiveViewComponent'; import { RiveErrorType, type RiveError } from './Errors'; export interface RiveViewProps diff --git a/src/index.tsx b/src/index.tsx index 63832fd1..5388a8a0 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -1,10 +1,4 @@ -import { - getHostComponent, - NitroModules, - type ReactNativeView, - type HybridView, -} from 'react-native-nitro-modules'; -import type { Rive } from './specs/Rive.nitro'; +import { type HybridView } from 'react-native-nitro-modules'; import { type RiveViewMethods, type RiveViewTSMethods, @@ -20,15 +14,7 @@ export class DataBindByName implements DataBindByNameInterface { } } -import RiveViewConfig from '../nitrogen/generated/shared/json/RiveViewConfig.json'; - -export const NitroRiveView = getHostComponent< - NativeRiveViewProps, - RiveViewMethods ->('RiveView', () => RiveViewConfig) as ReactNativeView< - NativeRiveViewProps, - RiveViewTSMethods ->; +export { NitroRiveView } from './core/NitroRiveViewComponent'; export { RiveView, type RiveViewProps } from './core/RiveView'; export type { RiveViewMethods }; From 81ff8bff4b68889cf14e3b315ad60f9359fc801d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mikl=C3=B3s=20Fazekas?= Date: Wed, 19 Nov 2025 12:30:04 +0100 Subject: [PATCH 5/9] fix: add missing error types and correct error mappings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add IncorrectAnimationName and IncorrectStateMachineInputName error types - Fix iOS to map noStateMachineInputFound to IncorrectStateMachineInputName instead of IncorrectAnimationName - Fix Android to use correct error types instead of UNKNOWN - Regenerate Nitrogen bindings 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- ios/HybridRiveView.swift | 2 +- nitrogen/generated/android/c++/JRiveErrorType.hpp | 3 +++ .../android/kotlin/com/margelo/nitro/rive/RiveErrorType.kt | 3 ++- nitrogen/generated/ios/swift/RiveErrorType.swift | 4 ++++ nitrogen/generated/shared/c++/RiveErrorType.hpp | 3 ++- src/core/Errors.ts | 3 +++ 6 files changed, 15 insertions(+), 3 deletions(-) diff --git a/ios/HybridRiveView.swift b/ios/HybridRiveView.swift index bd9c16a2..8a55a1d9 100644 --- a/ios/HybridRiveView.swift +++ b/ios/HybridRiveView.swift @@ -230,7 +230,7 @@ extension HybridRiveView { case RiveErrorCode.malformedFile.rawValue: return (.malformedfile, message) case RiveErrorCode.noStateMachineInputFound.rawValue: - return (.incorrectanimationname, message) + return (.incorrectstatemachineinputname, message) default: return (.unknown, message) } diff --git a/nitrogen/generated/android/c++/JRiveErrorType.hpp b/nitrogen/generated/android/c++/JRiveErrorType.hpp index afef86ee..0996e882 100644 --- a/nitrogen/generated/android/c++/JRiveErrorType.hpp +++ b/nitrogen/generated/android/c++/JRiveErrorType.hpp @@ -49,6 +49,7 @@ namespace margelo::nitro::rive { static const auto fieldINCORRECTANIMATIONNAME = clazz->getStaticField("INCORRECTANIMATIONNAME"); static const auto fieldDATABINDINGERROR = clazz->getStaticField("DATABINDINGERROR"); static const auto fieldTEXTRUNNOTFOUNDERROR = clazz->getStaticField("TEXTRUNNOTFOUNDERROR"); + static const auto fieldINCORRECTSTATEMACHINEINPUTNAME = clazz->getStaticField("INCORRECTSTATEMACHINEINPUTNAME"); switch (value) { case RiveErrorType::UNKNOWN: @@ -67,6 +68,8 @@ namespace margelo::nitro::rive { return clazz->getStaticFieldValue(fieldDATABINDINGERROR); case RiveErrorType::TEXTRUNNOTFOUNDERROR: return clazz->getStaticFieldValue(fieldTEXTRUNNOTFOUNDERROR); + case RiveErrorType::INCORRECTSTATEMACHINEINPUTNAME: + return clazz->getStaticFieldValue(fieldINCORRECTSTATEMACHINEINPUTNAME); default: std::string stringValue = std::to_string(static_cast(value)); throw std::invalid_argument("Invalid enum value (" + stringValue + "!"); diff --git a/nitrogen/generated/android/kotlin/com/margelo/nitro/rive/RiveErrorType.kt b/nitrogen/generated/android/kotlin/com/margelo/nitro/rive/RiveErrorType.kt index a9ed8331..88221f99 100644 --- a/nitrogen/generated/android/kotlin/com/margelo/nitro/rive/RiveErrorType.kt +++ b/nitrogen/generated/android/kotlin/com/margelo/nitro/rive/RiveErrorType.kt @@ -23,5 +23,6 @@ enum class RiveErrorType(@DoNotStrip @Keep val value: Int) { INCORRECTSTATEMACHINENAME(4), INCORRECTANIMATIONNAME(5), DATABINDINGERROR(6), - TEXTRUNNOTFOUNDERROR(7); + TEXTRUNNOTFOUNDERROR(7), + INCORRECTSTATEMACHINEINPUTNAME(8); } diff --git a/nitrogen/generated/ios/swift/RiveErrorType.swift b/nitrogen/generated/ios/swift/RiveErrorType.swift index fc03bb7b..1643b013 100644 --- a/nitrogen/generated/ios/swift/RiveErrorType.swift +++ b/nitrogen/generated/ios/swift/RiveErrorType.swift @@ -33,6 +33,8 @@ public extension RiveErrorType { self = .databindingerror case "TextRunNotFoundError": self = .textrunnotfounderror + case "IncorrectStateMachineInputName": + self = .incorrectstatemachineinputname default: return nil } @@ -59,6 +61,8 @@ public extension RiveErrorType { return "DataBindingError" case .textrunnotfounderror: return "TextRunNotFoundError" + case .incorrectstatemachineinputname: + return "IncorrectStateMachineInputName" } } } diff --git a/nitrogen/generated/shared/c++/RiveErrorType.hpp b/nitrogen/generated/shared/c++/RiveErrorType.hpp index d5cf1f69..56d73200 100644 --- a/nitrogen/generated/shared/c++/RiveErrorType.hpp +++ b/nitrogen/generated/shared/c++/RiveErrorType.hpp @@ -32,6 +32,7 @@ namespace margelo::nitro::rive { INCORRECTANIMATIONNAME SWIFT_NAME(incorrectanimationname) = 5, DATABINDINGERROR SWIFT_NAME(databindingerror) = 6, TEXTRUNNOTFOUNDERROR SWIFT_NAME(textrunnotfounderror) = 7, + INCORRECTSTATEMACHINEINPUTNAME SWIFT_NAME(incorrectstatemachineinputname) = 8, } CLOSED_ENUM; } // namespace margelo::nitro::rive @@ -61,7 +62,7 @@ namespace margelo::nitro { return false; } // Check if we are within the bounds of the enum. - return integer >= 0 && integer <= 7; + return integer >= 0 && integer <= 8; } }; diff --git a/src/core/Errors.ts b/src/core/Errors.ts index c85efaae..61b04a39 100644 --- a/src/core/Errors.ts +++ b/src/core/Errors.ts @@ -4,7 +4,10 @@ export enum RiveErrorType { MalformedFile = 2, IncorrectArtboardName = 3, IncorrectStateMachineName = 4, + IncorrectAnimationName = 5, DataBindingError = 6, + TextRunNotFoundError = 7, + IncorrectStateMachineInputName = 8, } export interface RiveError { From d2fd31082984fdf4b502c3737c4de40ad8978d10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mikl=C3=B3s=20Fazekas?= Date: Wed, 19 Nov 2025 12:41:58 +0100 Subject: [PATCH 6/9] refactor: simplify error types and add tuple return to Android MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Rename DataBindingError to ViewModelInstanceNotFound - Remove IncorrectAnimationName (map to Unknown) - Remove TextRunNotFoundError (map to Unknown) - Make Android detectErrorType return Pair for consistency with iOS - Update both platforms to use cleaner error messages - Regenerate Nitrogen bindings 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .../com/margelo/nitro/rive/HybridRiveView.kt | 17 ++++++++++------- ios/HybridRiveView.swift | 4 ++-- .../generated/android/c++/JRiveErrorType.hpp | 12 +++--------- .../com/margelo/nitro/rive/RiveErrorType.kt | 4 +--- .../generated/ios/swift/RiveErrorType.swift | 16 ++++------------ nitrogen/generated/shared/c++/RiveErrorType.hpp | 16 +++++++++++----- src/core/Errors.ts | 4 +--- 7 files changed, 32 insertions(+), 41 deletions(-) diff --git a/android/src/main/java/com/margelo/nitro/rive/HybridRiveView.kt b/android/src/main/java/com/margelo/nitro/rive/HybridRiveView.kt index 682df525..04f311a5 100644 --- a/android/src/main/java/com/margelo/nitro/rive/HybridRiveView.kt +++ b/android/src/main/java/com/margelo/nitro/rive/HybridRiveView.kt @@ -225,25 +225,28 @@ class HybridRiveView(val context: ThemedReactContext) : HybridRiveViewSpec() { } } - private fun detectErrorType(exception: Exception): RiveErrorType { - return when (exception) { + private fun detectErrorType(exception: Exception): Pair { + val message = exception.message ?: exception.toString() + val type = when (exception) { is ArtboardException -> RiveErrorType.INCORRECTARTBOARDNAME is StateMachineException -> RiveErrorType.INCORRECTSTATEMACHINENAME - is AnimationException -> RiveErrorType.INCORRECTANIMATIONNAME + is AnimationException -> RiveErrorType.UNKNOWN is MalformedFileException -> RiveErrorType.MALFORMEDFILE is StateMachineInputException -> RiveErrorType.INCORRECTSTATEMACHINEINPUTNAME - is TextValueRunException -> RiveErrorType.TEXTRUNNOTFOUNDERROR - is ViewModelException -> RiveErrorType.DATABINDINGERROR + is TextValueRunException -> RiveErrorType.UNKNOWN + is ViewModelException -> RiveErrorType.VIEWMODELINSTANCENOTFOUND else -> RiveErrorType.UNKNOWN } + return Pair(type, message) } fun logged(tag: String, note: String? = null, fn: () -> Unit) { try { fn() } catch (e: Exception) { - val errorMessage = "[RIVE] $tag ${note ?: ""} $e" - val errorType = detectErrorType(e) + val (errorType, errorDescription) = detectErrorType(e) + val noteString = note?.let { " $it" } ?: "" + val errorMessage = "[RIVE] $tag$noteString $errorDescription" val riveError = RiveError( type = errorType, message = errorMessage diff --git a/ios/HybridRiveView.swift b/ios/HybridRiveView.swift index 8a55a1d9..55d1ece3 100644 --- a/ios/HybridRiveView.swift +++ b/ios/HybridRiveView.swift @@ -209,7 +209,7 @@ extension HybridRiveView { private func detectErrorType(_ error: Error) -> (RiveErrorType, String) { switch error { case NitroRiveError.instanceNotFound(let message): - return (.databindingerror, message) + return (.viewmodelinstancenotfound, message) case NitroRiveError.fileNotFound(let message): return (.filenotfound, message) default: @@ -226,7 +226,7 @@ extension HybridRiveView { case RiveErrorCode.noStateMachineFound.rawValue: return (.incorrectstatemachinename, message) case RiveErrorCode.noAnimationFound.rawValue: - return (.incorrectanimationname, message) + return (.unknown, message) case RiveErrorCode.malformedFile.rawValue: return (.malformedfile, message) case RiveErrorCode.noStateMachineInputFound.rawValue: diff --git a/nitrogen/generated/android/c++/JRiveErrorType.hpp b/nitrogen/generated/android/c++/JRiveErrorType.hpp index 0996e882..0d601834 100644 --- a/nitrogen/generated/android/c++/JRiveErrorType.hpp +++ b/nitrogen/generated/android/c++/JRiveErrorType.hpp @@ -46,9 +46,7 @@ namespace margelo::nitro::rive { static const auto fieldMALFORMEDFILE = clazz->getStaticField("MALFORMEDFILE"); static const auto fieldINCORRECTARTBOARDNAME = clazz->getStaticField("INCORRECTARTBOARDNAME"); static const auto fieldINCORRECTSTATEMACHINENAME = clazz->getStaticField("INCORRECTSTATEMACHINENAME"); - static const auto fieldINCORRECTANIMATIONNAME = clazz->getStaticField("INCORRECTANIMATIONNAME"); - static const auto fieldDATABINDINGERROR = clazz->getStaticField("DATABINDINGERROR"); - static const auto fieldTEXTRUNNOTFOUNDERROR = clazz->getStaticField("TEXTRUNNOTFOUNDERROR"); + static const auto fieldVIEWMODELINSTANCENOTFOUND = clazz->getStaticField("VIEWMODELINSTANCENOTFOUND"); static const auto fieldINCORRECTSTATEMACHINEINPUTNAME = clazz->getStaticField("INCORRECTSTATEMACHINEINPUTNAME"); switch (value) { @@ -62,12 +60,8 @@ namespace margelo::nitro::rive { return clazz->getStaticFieldValue(fieldINCORRECTARTBOARDNAME); case RiveErrorType::INCORRECTSTATEMACHINENAME: return clazz->getStaticFieldValue(fieldINCORRECTSTATEMACHINENAME); - case RiveErrorType::INCORRECTANIMATIONNAME: - return clazz->getStaticFieldValue(fieldINCORRECTANIMATIONNAME); - case RiveErrorType::DATABINDINGERROR: - return clazz->getStaticFieldValue(fieldDATABINDINGERROR); - case RiveErrorType::TEXTRUNNOTFOUNDERROR: - return clazz->getStaticFieldValue(fieldTEXTRUNNOTFOUNDERROR); + case RiveErrorType::VIEWMODELINSTANCENOTFOUND: + return clazz->getStaticFieldValue(fieldVIEWMODELINSTANCENOTFOUND); case RiveErrorType::INCORRECTSTATEMACHINEINPUTNAME: return clazz->getStaticFieldValue(fieldINCORRECTSTATEMACHINEINPUTNAME); default: diff --git a/nitrogen/generated/android/kotlin/com/margelo/nitro/rive/RiveErrorType.kt b/nitrogen/generated/android/kotlin/com/margelo/nitro/rive/RiveErrorType.kt index 88221f99..b2aac955 100644 --- a/nitrogen/generated/android/kotlin/com/margelo/nitro/rive/RiveErrorType.kt +++ b/nitrogen/generated/android/kotlin/com/margelo/nitro/rive/RiveErrorType.kt @@ -21,8 +21,6 @@ enum class RiveErrorType(@DoNotStrip @Keep val value: Int) { MALFORMEDFILE(2), INCORRECTARTBOARDNAME(3), INCORRECTSTATEMACHINENAME(4), - INCORRECTANIMATIONNAME(5), - DATABINDINGERROR(6), - TEXTRUNNOTFOUNDERROR(7), + VIEWMODELINSTANCENOTFOUND(6), INCORRECTSTATEMACHINEINPUTNAME(8); } diff --git a/nitrogen/generated/ios/swift/RiveErrorType.swift b/nitrogen/generated/ios/swift/RiveErrorType.swift index 1643b013..b5ef2e41 100644 --- a/nitrogen/generated/ios/swift/RiveErrorType.swift +++ b/nitrogen/generated/ios/swift/RiveErrorType.swift @@ -27,12 +27,8 @@ public extension RiveErrorType { self = .incorrectartboardname case "IncorrectStateMachineName": self = .incorrectstatemachinename - case "IncorrectAnimationName": - self = .incorrectanimationname - case "DataBindingError": - self = .databindingerror - case "TextRunNotFoundError": - self = .textrunnotfounderror + case "ViewModelInstanceNotFound": + self = .viewmodelinstancenotfound case "IncorrectStateMachineInputName": self = .incorrectstatemachineinputname default: @@ -55,12 +51,8 @@ public extension RiveErrorType { return "IncorrectArtboardName" case .incorrectstatemachinename: return "IncorrectStateMachineName" - case .incorrectanimationname: - return "IncorrectAnimationName" - case .databindingerror: - return "DataBindingError" - case .textrunnotfounderror: - return "TextRunNotFoundError" + case .viewmodelinstancenotfound: + return "ViewModelInstanceNotFound" case .incorrectstatemachineinputname: return "IncorrectStateMachineInputName" } diff --git a/nitrogen/generated/shared/c++/RiveErrorType.hpp b/nitrogen/generated/shared/c++/RiveErrorType.hpp index 56d73200..28ee3c9b 100644 --- a/nitrogen/generated/shared/c++/RiveErrorType.hpp +++ b/nitrogen/generated/shared/c++/RiveErrorType.hpp @@ -29,9 +29,7 @@ namespace margelo::nitro::rive { MALFORMEDFILE SWIFT_NAME(malformedfile) = 2, INCORRECTARTBOARDNAME SWIFT_NAME(incorrectartboardname) = 3, INCORRECTSTATEMACHINENAME SWIFT_NAME(incorrectstatemachinename) = 4, - INCORRECTANIMATIONNAME SWIFT_NAME(incorrectanimationname) = 5, - DATABINDINGERROR SWIFT_NAME(databindingerror) = 6, - TEXTRUNNOTFOUNDERROR SWIFT_NAME(textrunnotfounderror) = 7, + VIEWMODELINSTANCENOTFOUND SWIFT_NAME(viewmodelinstancenotfound) = 6, INCORRECTSTATEMACHINEINPUTNAME SWIFT_NAME(incorrectstatemachineinputname) = 8, } CLOSED_ENUM; @@ -61,8 +59,16 @@ namespace margelo::nitro { // Enums are all integers, so the input floating point number is obviously invalid. return false; } - // Check if we are within the bounds of the enum. - return integer >= 0 && integer <= 8; + switch (integer) { + case 0 /* UNKNOWN */: return true; + case 1 /* FILENOTFOUND */: return true; + case 2 /* MALFORMEDFILE */: return true; + case 3 /* INCORRECTARTBOARDNAME */: return true; + case 4 /* INCORRECTSTATEMACHINENAME */: return true; + case 6 /* VIEWMODELINSTANCENOTFOUND */: return true; + case 8 /* INCORRECTSTATEMACHINEINPUTNAME */: return true; + default: return false; + } } }; diff --git a/src/core/Errors.ts b/src/core/Errors.ts index 61b04a39..757fc409 100644 --- a/src/core/Errors.ts +++ b/src/core/Errors.ts @@ -4,9 +4,7 @@ export enum RiveErrorType { MalformedFile = 2, IncorrectArtboardName = 3, IncorrectStateMachineName = 4, - IncorrectAnimationName = 5, - DataBindingError = 6, - TextRunNotFoundError = 7, + ViewModelInstanceNotFound = 6, IncorrectStateMachineInputName = 8, } From 3791d5123daa3b01571bb12290a56b990a4bbc8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mikl=C3=B3s=20Fazekas?= Date: Wed, 19 Nov 2025 12:50:19 +0100 Subject: [PATCH 7/9] fix: remove deprecated deep import for resolveAsset --- src/core/RiveFile.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/core/RiveFile.ts b/src/core/RiveFile.ts index 364e901f..c6626667 100644 --- a/src/core/RiveFile.ts +++ b/src/core/RiveFile.ts @@ -4,9 +4,7 @@ import type { RiveFileFactory as RiveFileFactoryInternal, } from '../specs/RiveFile.nitro'; -// This import path isn't handled by @types/react-native -// @ts-ignore -import resolveAssetSource from 'react-native/Libraries/Image/resolveAssetSource'; +import { Image } from 'react-native'; import type { ResolvedReferencedAssets } from './ReferencedAssets'; const RiveFileInternal = @@ -119,7 +117,9 @@ export namespace RiveFileFactory { const assetID = typeof source === 'number' ? source : null; const sourceURI = typeof source === 'object' ? source.uri : null; - const assetURI = assetID ? resolveAssetSource(assetID)?.uri : sourceURI; + const assetURI = assetID + ? Image.resolveAssetSource(assetID)?.uri + : sourceURI; if (!assetURI) { throw new Error( From 6974de02b1468c0efe06967b4d18d5775e4145d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mikl=C3=B3s=20Fazekas?= Date: Wed, 19 Nov 2025 15:13:45 +0100 Subject: [PATCH 8/9] chore: fix the lib to build on ios and droid --- .../com/margelo/nitro/rive/HybridRiveView.kt | 4 ++ example/ios/Podfile.lock | 60 ++++++++-------- nitro.json | 2 +- .../c++/HybridRiveFileFactorySpecSwift.hpp | 10 +-- .../ios/c++/HybridRiveFileSpecSwift.hpp | 10 +-- .../generated/ios/c++/HybridRiveSpecSwift.hpp | 10 +-- .../ios/c++/HybridRiveViewSpecSwift.hpp | 10 +-- ...ybridViewModelBooleanPropertySpecSwift.hpp | 10 +-- .../HybridViewModelColorPropertySpecSwift.hpp | 10 +-- .../HybridViewModelEnumPropertySpecSwift.hpp | 10 +-- .../c++/HybridViewModelInstanceSpecSwift.hpp | 10 +-- ...HybridViewModelNumberPropertySpecSwift.hpp | 10 +-- .../c++/HybridViewModelPropertySpecSwift.hpp | 10 +-- .../ios/c++/HybridViewModelSpecSwift.hpp | 10 +-- ...HybridViewModelStringPropertySpecSwift.hpp | 10 +-- ...ybridViewModelTriggerPropertySpecSwift.hpp | 10 +-- .../ios/c++/views/HybridRiveViewComponent.mm | 8 +-- ...ng.rb => react_native_rive+autolinking.rb} | 8 +-- ...=> react_native_rive-Swift-Cxx-Bridge.cpp} | 72 +++++++++---------- ...=> react_native_rive-Swift-Cxx-Bridge.hpp} | 28 ++++---- ... react_native_rive-Swift-Cxx-Umbrella.hpp} | 42 +++++------ ...ing.mm => react_native_riveAutolinking.mm} | 32 ++++----- ...ift => react_native_riveAutolinking.swift} | 4 +- .../swift/HybridRiveFileFactorySpec_cxx.swift | 2 +- .../ios/swift/HybridRiveFileSpec_cxx.swift | 2 +- .../ios/swift/HybridRiveSpec_cxx.swift | 2 +- .../ios/swift/HybridRiveViewSpec_cxx.swift | 2 +- ...bridViewModelBooleanPropertySpec_cxx.swift | 2 +- ...HybridViewModelColorPropertySpec_cxx.swift | 2 +- .../HybridViewModelEnumPropertySpec_cxx.swift | 2 +- .../HybridViewModelInstanceSpec_cxx.swift | 2 +- ...ybridViewModelNumberPropertySpec_cxx.swift | 2 +- .../HybridViewModelPropertySpec_cxx.swift | 2 +- .../ios/swift/HybridViewModelSpec_cxx.swift | 2 +- ...ybridViewModelStringPropertySpec_cxx.swift | 2 +- ...bridViewModelTriggerPropertySpec_cxx.swift | 2 +- ...-rive.podspec => react_native_rive.podspec | 4 +- 37 files changed, 212 insertions(+), 208 deletions(-) rename nitrogen/generated/ios/{Rive+autolinking.rb => react_native_rive+autolinking.rb} (87%) rename nitrogen/generated/ios/{Rive-Swift-Cxx-Bridge.cpp => react_native_rive-Swift-Cxx-Bridge.cpp} (78%) rename nitrogen/generated/ios/{Rive-Swift-Cxx-Bridge.hpp => react_native_rive-Swift-Cxx-Bridge.hpp} (98%) rename nitrogen/generated/ios/{Rive-Swift-Cxx-Umbrella.hpp => react_native_rive-Swift-Cxx-Umbrella.hpp} (82%) rename nitrogen/generated/ios/{RiveAutolinking.mm => react_native_riveAutolinking.mm} (71%) rename nitrogen/generated/ios/{RiveAutolinking.swift => react_native_riveAutolinking.swift} (98%) rename react-native-rive.podspec => react_native_rive.podspec (94%) diff --git a/android/src/main/java/com/margelo/nitro/rive/HybridRiveView.kt b/android/src/main/java/com/margelo/nitro/rive/HybridRiveView.kt index 04f311a5..7678469e 100644 --- a/android/src/main/java/com/margelo/nitro/rive/HybridRiveView.kt +++ b/android/src/main/java/com/margelo/nitro/rive/HybridRiveView.kt @@ -47,6 +47,10 @@ object DefaultConfiguration { @Keep @DoNotStrip class HybridRiveView(val context: ThemedReactContext) : HybridRiveViewSpec() { + companion object { + private const val TAG = "HybridRiveView" + } + //region State override val view: RiveReactNativeView = RiveReactNativeView(context) private var needsReload = false diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index f8ed5f9d..d66f46dd 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -1357,32 +1357,6 @@ PODS: - React-jsiexecutor - React-RCTFBReactNativeSpec - ReactCommon/turbomodule/core - - react-native-rive (0.1.0): - - DoubleConversion - - glog - - hermes-engine - - NitroModules - - RCT-Folly (= 2024.11.18.00) - - RCTRequired - - RCTTypeSafety - - React-Core - - React-debug - - React-Fabric - - React-featureflags - - React-graphics - - React-hermes - - React-ImageManager - - React-jsi - - React-NativeModulesApple - - React-RCTFabric - - React-renderercss - - React-rendererdebug - - React-utils - - ReactCodegen - - ReactCommon/turbomodule/bridging - - ReactCommon/turbomodule/core - - RiveRuntime (= 6.12.0) - - Yoga - react-native-safe-area-context (5.6.2): - DoubleConversion - glog @@ -1713,6 +1687,32 @@ PODS: - React-debug - React-hermes - React-jsi (= 0.79.2) + - react_native_rive (0.1.0): + - DoubleConversion + - glog + - hermes-engine + - NitroModules + - RCT-Folly (= 2024.11.18.00) + - RCTRequired + - RCTTypeSafety + - React-Core + - React-debug + - React-Fabric + - React-featureflags + - React-graphics + - React-hermes + - React-ImageManager + - React-jsi + - React-NativeModulesApple + - React-RCTFabric + - React-renderercss + - React-rendererdebug + - React-utils + - ReactCodegen + - ReactCommon/turbomodule/bridging + - ReactCommon/turbomodule/core + - RiveRuntime (= 6.12.0) + - Yoga - ReactAppDependencyProvider (0.79.2): - ReactCodegen - ReactCodegen (0.79.2): @@ -1874,7 +1874,6 @@ DEPENDENCIES: - React-logger (from `../node_modules/react-native/ReactCommon/logger`) - React-Mapbuffer (from `../node_modules/react-native/ReactCommon`) - React-microtasksnativemodule (from `../node_modules/react-native/ReactCommon/react/nativemodule/microtasks`) - - react-native-rive (from `../..`) - react-native-safe-area-context (from `../node_modules/react-native-safe-area-context`) - React-NativeModulesApple (from `../node_modules/react-native/ReactCommon/react/nativemodule/core/platform/ios`) - React-oscompat (from `../node_modules/react-native/ReactCommon/oscompat`) @@ -1904,6 +1903,7 @@ DEPENDENCIES: - React-runtimescheduler (from `../node_modules/react-native/ReactCommon/react/renderer/runtimescheduler`) - React-timing (from `../node_modules/react-native/ReactCommon/react/timing`) - React-utils (from `../node_modules/react-native/ReactCommon/react/utils`) + - react_native_rive (from `../..`) - ReactAppDependencyProvider (from `build/generated/ios`) - ReactCodegen (from `build/generated/ios`) - ReactCommon/turbomodule/core (from `../node_modules/react-native/ReactCommon`) @@ -1996,8 +1996,6 @@ EXTERNAL SOURCES: :path: "../node_modules/react-native/ReactCommon" React-microtasksnativemodule: :path: "../node_modules/react-native/ReactCommon/react/nativemodule/microtasks" - react-native-rive: - :path: "../.." react-native-safe-area-context: :path: "../node_modules/react-native-safe-area-context" React-NativeModulesApple: @@ -2056,6 +2054,8 @@ EXTERNAL SOURCES: :path: "../node_modules/react-native/ReactCommon/react/timing" React-utils: :path: "../node_modules/react-native/ReactCommon/react/utils" + react_native_rive: + :path: "../.." ReactAppDependencyProvider: :path: build/generated/ios ReactCodegen: @@ -2109,7 +2109,6 @@ SPEC CHECKSUMS: React-logger: 368570a253f00879a1e4fea24ed4047e72e7bbf3 React-Mapbuffer: c04fcda1c6281fc0a6824c7dcc1633dd217ac1ec React-microtasksnativemodule: ca2804a25fdcefffa0aa942aa23ab53b99614a34 - react-native-rive: 7e008c7a01eba3d71d98813f77b4221699290990 react-native-safe-area-context: bc59472155ffb889a1ffe16c19a04c0cd451562b React-NativeModulesApple: 452b86b29fae99ed0a4015dca3ad9cd222f88abf React-oscompat: ef5df1c734f19b8003e149317d041b8ce1f7d29c @@ -2139,6 +2138,7 @@ SPEC CHECKSUMS: React-runtimescheduler: e917ab17ae08c204af1ebf8f669b7e411b0220c8 React-timing: a90f4654cbda9c628614f9bee68967f1768bd6a5 React-utils: 51c4e71608b8133fecc9a15801d244ae7bdf3758 + react_native_rive: a6e6aa9ef2826c95aeaa7e40619a04f3887c8ac7 ReactAppDependencyProvider: d5dcc564f129632276bd3184e60f053fcd574d6b ReactCodegen: fda99a79c866370190e162083a35602fdc314e5d ReactCommon: 4d0da92a5eb8da86c08e3ec34bd23ab439fb2461 diff --git a/nitro.json b/nitro.json index 9c98b656..e1051a17 100644 --- a/nitro.json +++ b/nitro.json @@ -2,7 +2,7 @@ "$schema": "https://nitro.margelo.com/nitro.schema.json", "cxxNamespace": ["rive"], "ios": { - "iosModuleName": "Rive" + "iosModuleName": "react_native_rive" }, "android": { "androidNamespace": ["rive"], diff --git a/nitrogen/generated/ios/c++/HybridRiveFileFactorySpecSwift.hpp b/nitrogen/generated/ios/c++/HybridRiveFileFactorySpecSwift.hpp index 098ab3ea..27323c9d 100644 --- a/nitrogen/generated/ios/c++/HybridRiveFileFactorySpecSwift.hpp +++ b/nitrogen/generated/ios/c++/HybridRiveFileFactorySpecSwift.hpp @@ -10,7 +10,7 @@ #include "HybridRiveFileFactorySpec.hpp" // Forward declaration of `HybridRiveFileFactorySpec_cxx` to properly resolve imports. -namespace Rive { class HybridRiveFileFactorySpec_cxx; } +namespace react_native_rive { class HybridRiveFileFactorySpec_cxx; } // Forward declaration of `HybridRiveFileSpec` to properly resolve imports. namespace margelo::nitro::rive { class HybridRiveFileSpec; } @@ -32,7 +32,7 @@ namespace NitroModules { class ArrayBufferHolder; } #include #include -#include "Rive-Swift-Cxx-Umbrella.hpp" +#include "react_native_rive-Swift-Cxx-Umbrella.hpp" namespace margelo::nitro::rive { @@ -49,13 +49,13 @@ namespace margelo::nitro::rive { class HybridRiveFileFactorySpecSwift: public virtual HybridRiveFileFactorySpec { public: // Constructor from a Swift instance - explicit HybridRiveFileFactorySpecSwift(const Rive::HybridRiveFileFactorySpec_cxx& swiftPart): + explicit HybridRiveFileFactorySpecSwift(const react_native_rive::HybridRiveFileFactorySpec_cxx& swiftPart): HybridObject(HybridRiveFileFactorySpec::TAG), _swiftPart(swiftPart) { } public: // Get the Swift part - inline Rive::HybridRiveFileFactorySpec_cxx& getSwiftPart() noexcept { + inline react_native_rive::HybridRiveFileFactorySpec_cxx& getSwiftPart() noexcept { return _swiftPart; } @@ -110,7 +110,7 @@ namespace margelo::nitro::rive { } private: - Rive::HybridRiveFileFactorySpec_cxx _swiftPart; + react_native_rive::HybridRiveFileFactorySpec_cxx _swiftPart; }; } // namespace margelo::nitro::rive diff --git a/nitrogen/generated/ios/c++/HybridRiveFileSpecSwift.hpp b/nitrogen/generated/ios/c++/HybridRiveFileSpecSwift.hpp index e2dae7ae..b5c79485 100644 --- a/nitrogen/generated/ios/c++/HybridRiveFileSpecSwift.hpp +++ b/nitrogen/generated/ios/c++/HybridRiveFileSpecSwift.hpp @@ -10,7 +10,7 @@ #include "HybridRiveFileSpec.hpp" // Forward declaration of `HybridRiveFileSpec_cxx` to properly resolve imports. -namespace Rive { class HybridRiveFileSpec_cxx; } +namespace react_native_rive { class HybridRiveFileSpec_cxx; } // Forward declaration of `HybridViewModelSpec` to properly resolve imports. namespace margelo::nitro::rive { class HybridViewModelSpec; } @@ -33,7 +33,7 @@ namespace margelo::nitro::rive { struct ResolvedReferencedAsset; } #include "ResolvedReferencedAsset.hpp" #include -#include "Rive-Swift-Cxx-Umbrella.hpp" +#include "react_native_rive-Swift-Cxx-Umbrella.hpp" namespace margelo::nitro::rive { @@ -50,13 +50,13 @@ namespace margelo::nitro::rive { class HybridRiveFileSpecSwift: public virtual HybridRiveFileSpec { public: // Constructor from a Swift instance - explicit HybridRiveFileSpecSwift(const Rive::HybridRiveFileSpec_cxx& swiftPart): + explicit HybridRiveFileSpecSwift(const react_native_rive::HybridRiveFileSpec_cxx& swiftPart): HybridObject(HybridRiveFileSpec::TAG), _swiftPart(swiftPart) { } public: // Get the Swift part - inline Rive::HybridRiveFileSpec_cxx& getSwiftPart() noexcept { + inline react_native_rive::HybridRiveFileSpec_cxx& getSwiftPart() noexcept { return _swiftPart; } @@ -118,7 +118,7 @@ namespace margelo::nitro::rive { } private: - Rive::HybridRiveFileSpec_cxx _swiftPart; + react_native_rive::HybridRiveFileSpec_cxx _swiftPart; }; } // namespace margelo::nitro::rive diff --git a/nitrogen/generated/ios/c++/HybridRiveSpecSwift.hpp b/nitrogen/generated/ios/c++/HybridRiveSpecSwift.hpp index b8cfe56d..a23e6642 100644 --- a/nitrogen/generated/ios/c++/HybridRiveSpecSwift.hpp +++ b/nitrogen/generated/ios/c++/HybridRiveSpecSwift.hpp @@ -10,13 +10,13 @@ #include "HybridRiveSpec.hpp" // Forward declaration of `HybridRiveSpec_cxx` to properly resolve imports. -namespace Rive { class HybridRiveSpec_cxx; } +namespace react_native_rive { class HybridRiveSpec_cxx; } -#include "Rive-Swift-Cxx-Umbrella.hpp" +#include "react_native_rive-Swift-Cxx-Umbrella.hpp" namespace margelo::nitro::rive { @@ -33,13 +33,13 @@ namespace margelo::nitro::rive { class HybridRiveSpecSwift: public virtual HybridRiveSpec { public: // Constructor from a Swift instance - explicit HybridRiveSpecSwift(const Rive::HybridRiveSpec_cxx& swiftPart): + explicit HybridRiveSpecSwift(const react_native_rive::HybridRiveSpec_cxx& swiftPart): HybridObject(HybridRiveSpec::TAG), _swiftPart(swiftPart) { } public: // Get the Swift part - inline Rive::HybridRiveSpec_cxx& getSwiftPart() noexcept { + inline react_native_rive::HybridRiveSpec_cxx& getSwiftPart() noexcept { return _swiftPart; } @@ -70,7 +70,7 @@ namespace margelo::nitro::rive { } private: - Rive::HybridRiveSpec_cxx _swiftPart; + react_native_rive::HybridRiveSpec_cxx _swiftPart; }; } // namespace margelo::nitro::rive diff --git a/nitrogen/generated/ios/c++/HybridRiveViewSpecSwift.hpp b/nitrogen/generated/ios/c++/HybridRiveViewSpecSwift.hpp index dcfd15d5..3b856170 100644 --- a/nitrogen/generated/ios/c++/HybridRiveViewSpecSwift.hpp +++ b/nitrogen/generated/ios/c++/HybridRiveViewSpecSwift.hpp @@ -10,7 +10,7 @@ #include "HybridRiveViewSpec.hpp" // Forward declaration of `HybridRiveViewSpec_cxx` to properly resolve imports. -namespace Rive { class HybridRiveViewSpec_cxx; } +namespace react_native_rive { class HybridRiveViewSpec_cxx; } // Forward declaration of `HybridRiveFileSpec` to properly resolve imports. namespace margelo::nitro::rive { class HybridRiveFileSpec; } @@ -51,7 +51,7 @@ namespace margelo::nitro::rive { enum class RiveEventType; } #include "RiveEventType.hpp" #include -#include "Rive-Swift-Cxx-Umbrella.hpp" +#include "react_native_rive-Swift-Cxx-Umbrella.hpp" namespace margelo::nitro::rive { @@ -68,13 +68,13 @@ namespace margelo::nitro::rive { class HybridRiveViewSpecSwift: public virtual HybridRiveViewSpec { public: // Constructor from a Swift instance - explicit HybridRiveViewSpecSwift(const Rive::HybridRiveViewSpec_cxx& swiftPart): + explicit HybridRiveViewSpecSwift(const react_native_rive::HybridRiveViewSpec_cxx& swiftPart): HybridObject(HybridRiveViewSpec::TAG), _swiftPart(swiftPart) { } public: // Get the Swift part - inline Rive::HybridRiveViewSpec_cxx& getSwiftPart() noexcept { + inline react_native_rive::HybridRiveViewSpec_cxx& getSwiftPart() noexcept { return _swiftPart; } @@ -253,7 +253,7 @@ namespace margelo::nitro::rive { } private: - Rive::HybridRiveViewSpec_cxx _swiftPart; + react_native_rive::HybridRiveViewSpec_cxx _swiftPart; }; } // namespace margelo::nitro::rive diff --git a/nitrogen/generated/ios/c++/HybridViewModelBooleanPropertySpecSwift.hpp b/nitrogen/generated/ios/c++/HybridViewModelBooleanPropertySpecSwift.hpp index d1d3d83f..b8812007 100644 --- a/nitrogen/generated/ios/c++/HybridViewModelBooleanPropertySpecSwift.hpp +++ b/nitrogen/generated/ios/c++/HybridViewModelBooleanPropertySpecSwift.hpp @@ -10,7 +10,7 @@ #include "HybridViewModelBooleanPropertySpec.hpp" // Forward declaration of `HybridViewModelBooleanPropertySpec_cxx` to properly resolve imports. -namespace Rive { class HybridViewModelBooleanPropertySpec_cxx; } +namespace react_native_rive { class HybridViewModelBooleanPropertySpec_cxx; } // Forward declaration of `HybridViewModelPropertySpecSwift` to properly resolve imports. namespace margelo::nitro::rive { class HybridViewModelPropertySpecSwift; } @@ -18,7 +18,7 @@ namespace margelo::nitro::rive { class HybridViewModelPropertySpecSwift; } #include #include "HybridViewModelPropertySpecSwift.hpp" -#include "Rive-Swift-Cxx-Umbrella.hpp" +#include "react_native_rive-Swift-Cxx-Umbrella.hpp" namespace margelo::nitro::rive { @@ -35,14 +35,14 @@ namespace margelo::nitro::rive { class HybridViewModelBooleanPropertySpecSwift: public virtual HybridViewModelBooleanPropertySpec, public virtual HybridViewModelPropertySpecSwift { public: // Constructor from a Swift instance - explicit HybridViewModelBooleanPropertySpecSwift(const Rive::HybridViewModelBooleanPropertySpec_cxx& swiftPart): + explicit HybridViewModelBooleanPropertySpecSwift(const react_native_rive::HybridViewModelBooleanPropertySpec_cxx& swiftPart): HybridObject(HybridViewModelBooleanPropertySpec::TAG), HybridViewModelPropertySpecSwift(swiftPart), _swiftPart(swiftPart) { } public: // Get the Swift part - inline Rive::HybridViewModelBooleanPropertySpec_cxx& getSwiftPart() noexcept { + inline react_native_rive::HybridViewModelBooleanPropertySpec_cxx& getSwiftPart() noexcept { return _swiftPart; } @@ -82,7 +82,7 @@ namespace margelo::nitro::rive { } private: - Rive::HybridViewModelBooleanPropertySpec_cxx _swiftPart; + react_native_rive::HybridViewModelBooleanPropertySpec_cxx _swiftPart; }; } // namespace margelo::nitro::rive diff --git a/nitrogen/generated/ios/c++/HybridViewModelColorPropertySpecSwift.hpp b/nitrogen/generated/ios/c++/HybridViewModelColorPropertySpecSwift.hpp index 3c9840d4..58b46736 100644 --- a/nitrogen/generated/ios/c++/HybridViewModelColorPropertySpecSwift.hpp +++ b/nitrogen/generated/ios/c++/HybridViewModelColorPropertySpecSwift.hpp @@ -10,7 +10,7 @@ #include "HybridViewModelColorPropertySpec.hpp" // Forward declaration of `HybridViewModelColorPropertySpec_cxx` to properly resolve imports. -namespace Rive { class HybridViewModelColorPropertySpec_cxx; } +namespace react_native_rive { class HybridViewModelColorPropertySpec_cxx; } // Forward declaration of `HybridViewModelPropertySpecSwift` to properly resolve imports. namespace margelo::nitro::rive { class HybridViewModelPropertySpecSwift; } @@ -18,7 +18,7 @@ namespace margelo::nitro::rive { class HybridViewModelPropertySpecSwift; } #include #include "HybridViewModelPropertySpecSwift.hpp" -#include "Rive-Swift-Cxx-Umbrella.hpp" +#include "react_native_rive-Swift-Cxx-Umbrella.hpp" namespace margelo::nitro::rive { @@ -35,14 +35,14 @@ namespace margelo::nitro::rive { class HybridViewModelColorPropertySpecSwift: public virtual HybridViewModelColorPropertySpec, public virtual HybridViewModelPropertySpecSwift { public: // Constructor from a Swift instance - explicit HybridViewModelColorPropertySpecSwift(const Rive::HybridViewModelColorPropertySpec_cxx& swiftPart): + explicit HybridViewModelColorPropertySpecSwift(const react_native_rive::HybridViewModelColorPropertySpec_cxx& swiftPart): HybridObject(HybridViewModelColorPropertySpec::TAG), HybridViewModelPropertySpecSwift(swiftPart), _swiftPart(swiftPart) { } public: // Get the Swift part - inline Rive::HybridViewModelColorPropertySpec_cxx& getSwiftPart() noexcept { + inline react_native_rive::HybridViewModelColorPropertySpec_cxx& getSwiftPart() noexcept { return _swiftPart; } @@ -82,7 +82,7 @@ namespace margelo::nitro::rive { } private: - Rive::HybridViewModelColorPropertySpec_cxx _swiftPart; + react_native_rive::HybridViewModelColorPropertySpec_cxx _swiftPart; }; } // namespace margelo::nitro::rive diff --git a/nitrogen/generated/ios/c++/HybridViewModelEnumPropertySpecSwift.hpp b/nitrogen/generated/ios/c++/HybridViewModelEnumPropertySpecSwift.hpp index 9a934321..628e6f10 100644 --- a/nitrogen/generated/ios/c++/HybridViewModelEnumPropertySpecSwift.hpp +++ b/nitrogen/generated/ios/c++/HybridViewModelEnumPropertySpecSwift.hpp @@ -10,7 +10,7 @@ #include "HybridViewModelEnumPropertySpec.hpp" // Forward declaration of `HybridViewModelEnumPropertySpec_cxx` to properly resolve imports. -namespace Rive { class HybridViewModelEnumPropertySpec_cxx; } +namespace react_native_rive { class HybridViewModelEnumPropertySpec_cxx; } // Forward declaration of `HybridViewModelPropertySpecSwift` to properly resolve imports. namespace margelo::nitro::rive { class HybridViewModelPropertySpecSwift; } @@ -19,7 +19,7 @@ namespace margelo::nitro::rive { class HybridViewModelPropertySpecSwift; } #include #include "HybridViewModelPropertySpecSwift.hpp" -#include "Rive-Swift-Cxx-Umbrella.hpp" +#include "react_native_rive-Swift-Cxx-Umbrella.hpp" namespace margelo::nitro::rive { @@ -36,14 +36,14 @@ namespace margelo::nitro::rive { class HybridViewModelEnumPropertySpecSwift: public virtual HybridViewModelEnumPropertySpec, public virtual HybridViewModelPropertySpecSwift { public: // Constructor from a Swift instance - explicit HybridViewModelEnumPropertySpecSwift(const Rive::HybridViewModelEnumPropertySpec_cxx& swiftPart): + explicit HybridViewModelEnumPropertySpecSwift(const react_native_rive::HybridViewModelEnumPropertySpec_cxx& swiftPart): HybridObject(HybridViewModelEnumPropertySpec::TAG), HybridViewModelPropertySpecSwift(swiftPart), _swiftPart(swiftPart) { } public: // Get the Swift part - inline Rive::HybridViewModelEnumPropertySpec_cxx& getSwiftPart() noexcept { + inline react_native_rive::HybridViewModelEnumPropertySpec_cxx& getSwiftPart() noexcept { return _swiftPart; } @@ -84,7 +84,7 @@ namespace margelo::nitro::rive { } private: - Rive::HybridViewModelEnumPropertySpec_cxx _swiftPart; + react_native_rive::HybridViewModelEnumPropertySpec_cxx _swiftPart; }; } // namespace margelo::nitro::rive diff --git a/nitrogen/generated/ios/c++/HybridViewModelInstanceSpecSwift.hpp b/nitrogen/generated/ios/c++/HybridViewModelInstanceSpecSwift.hpp index 128ec856..4cfa00fe 100644 --- a/nitrogen/generated/ios/c++/HybridViewModelInstanceSpecSwift.hpp +++ b/nitrogen/generated/ios/c++/HybridViewModelInstanceSpecSwift.hpp @@ -10,7 +10,7 @@ #include "HybridViewModelInstanceSpec.hpp" // Forward declaration of `HybridViewModelInstanceSpec_cxx` to properly resolve imports. -namespace Rive { class HybridViewModelInstanceSpec_cxx; } +namespace react_native_rive { class HybridViewModelInstanceSpec_cxx; } // Forward declaration of `HybridViewModelNumberPropertySpec` to properly resolve imports. namespace margelo::nitro::rive { class HybridViewModelNumberPropertySpec; } @@ -35,7 +35,7 @@ namespace margelo::nitro::rive { class HybridViewModelTriggerPropertySpec; } #include "HybridViewModelEnumPropertySpec.hpp" #include "HybridViewModelTriggerPropertySpec.hpp" -#include "Rive-Swift-Cxx-Umbrella.hpp" +#include "react_native_rive-Swift-Cxx-Umbrella.hpp" namespace margelo::nitro::rive { @@ -52,13 +52,13 @@ namespace margelo::nitro::rive { class HybridViewModelInstanceSpecSwift: public virtual HybridViewModelInstanceSpec { public: // Constructor from a Swift instance - explicit HybridViewModelInstanceSpecSwift(const Rive::HybridViewModelInstanceSpec_cxx& swiftPart): + explicit HybridViewModelInstanceSpecSwift(const react_native_rive::HybridViewModelInstanceSpec_cxx& swiftPart): HybridObject(HybridViewModelInstanceSpec::TAG), _swiftPart(swiftPart) { } public: // Get the Swift part - inline Rive::HybridViewModelInstanceSpec_cxx& getSwiftPart() noexcept { + inline react_native_rive::HybridViewModelInstanceSpec_cxx& getSwiftPart() noexcept { return _swiftPart; } @@ -132,7 +132,7 @@ namespace margelo::nitro::rive { } private: - Rive::HybridViewModelInstanceSpec_cxx _swiftPart; + react_native_rive::HybridViewModelInstanceSpec_cxx _swiftPart; }; } // namespace margelo::nitro::rive diff --git a/nitrogen/generated/ios/c++/HybridViewModelNumberPropertySpecSwift.hpp b/nitrogen/generated/ios/c++/HybridViewModelNumberPropertySpecSwift.hpp index 908cedb3..08677579 100644 --- a/nitrogen/generated/ios/c++/HybridViewModelNumberPropertySpecSwift.hpp +++ b/nitrogen/generated/ios/c++/HybridViewModelNumberPropertySpecSwift.hpp @@ -10,7 +10,7 @@ #include "HybridViewModelNumberPropertySpec.hpp" // Forward declaration of `HybridViewModelNumberPropertySpec_cxx` to properly resolve imports. -namespace Rive { class HybridViewModelNumberPropertySpec_cxx; } +namespace react_native_rive { class HybridViewModelNumberPropertySpec_cxx; } // Forward declaration of `HybridViewModelPropertySpecSwift` to properly resolve imports. namespace margelo::nitro::rive { class HybridViewModelPropertySpecSwift; } @@ -18,7 +18,7 @@ namespace margelo::nitro::rive { class HybridViewModelPropertySpecSwift; } #include #include "HybridViewModelPropertySpecSwift.hpp" -#include "Rive-Swift-Cxx-Umbrella.hpp" +#include "react_native_rive-Swift-Cxx-Umbrella.hpp" namespace margelo::nitro::rive { @@ -35,14 +35,14 @@ namespace margelo::nitro::rive { class HybridViewModelNumberPropertySpecSwift: public virtual HybridViewModelNumberPropertySpec, public virtual HybridViewModelPropertySpecSwift { public: // Constructor from a Swift instance - explicit HybridViewModelNumberPropertySpecSwift(const Rive::HybridViewModelNumberPropertySpec_cxx& swiftPart): + explicit HybridViewModelNumberPropertySpecSwift(const react_native_rive::HybridViewModelNumberPropertySpec_cxx& swiftPart): HybridObject(HybridViewModelNumberPropertySpec::TAG), HybridViewModelPropertySpecSwift(swiftPart), _swiftPart(swiftPart) { } public: // Get the Swift part - inline Rive::HybridViewModelNumberPropertySpec_cxx& getSwiftPart() noexcept { + inline react_native_rive::HybridViewModelNumberPropertySpec_cxx& getSwiftPart() noexcept { return _swiftPart; } @@ -82,7 +82,7 @@ namespace margelo::nitro::rive { } private: - Rive::HybridViewModelNumberPropertySpec_cxx _swiftPart; + react_native_rive::HybridViewModelNumberPropertySpec_cxx _swiftPart; }; } // namespace margelo::nitro::rive diff --git a/nitrogen/generated/ios/c++/HybridViewModelPropertySpecSwift.hpp b/nitrogen/generated/ios/c++/HybridViewModelPropertySpecSwift.hpp index 91b71d94..b8b90e16 100644 --- a/nitrogen/generated/ios/c++/HybridViewModelPropertySpecSwift.hpp +++ b/nitrogen/generated/ios/c++/HybridViewModelPropertySpecSwift.hpp @@ -10,13 +10,13 @@ #include "HybridViewModelPropertySpec.hpp" // Forward declaration of `HybridViewModelPropertySpec_cxx` to properly resolve imports. -namespace Rive { class HybridViewModelPropertySpec_cxx; } +namespace react_native_rive { class HybridViewModelPropertySpec_cxx; } -#include "Rive-Swift-Cxx-Umbrella.hpp" +#include "react_native_rive-Swift-Cxx-Umbrella.hpp" namespace margelo::nitro::rive { @@ -33,13 +33,13 @@ namespace margelo::nitro::rive { class HybridViewModelPropertySpecSwift: public virtual HybridViewModelPropertySpec { public: // Constructor from a Swift instance - explicit HybridViewModelPropertySpecSwift(const Rive::HybridViewModelPropertySpec_cxx& swiftPart): + explicit HybridViewModelPropertySpecSwift(const react_native_rive::HybridViewModelPropertySpec_cxx& swiftPart): HybridObject(HybridViewModelPropertySpec::TAG), _swiftPart(swiftPart) { } public: // Get the Swift part - inline Rive::HybridViewModelPropertySpec_cxx& getSwiftPart() noexcept { + inline react_native_rive::HybridViewModelPropertySpec_cxx& getSwiftPart() noexcept { return _swiftPart; } @@ -63,7 +63,7 @@ namespace margelo::nitro::rive { private: - Rive::HybridViewModelPropertySpec_cxx _swiftPart; + react_native_rive::HybridViewModelPropertySpec_cxx _swiftPart; }; } // namespace margelo::nitro::rive diff --git a/nitrogen/generated/ios/c++/HybridViewModelSpecSwift.hpp b/nitrogen/generated/ios/c++/HybridViewModelSpecSwift.hpp index cbcd0b66..d00d191c 100644 --- a/nitrogen/generated/ios/c++/HybridViewModelSpecSwift.hpp +++ b/nitrogen/generated/ios/c++/HybridViewModelSpecSwift.hpp @@ -10,7 +10,7 @@ #include "HybridViewModelSpec.hpp" // Forward declaration of `HybridViewModelSpec_cxx` to properly resolve imports. -namespace Rive { class HybridViewModelSpec_cxx; } +namespace react_native_rive { class HybridViewModelSpec_cxx; } // Forward declaration of `HybridViewModelInstanceSpec` to properly resolve imports. namespace margelo::nitro::rive { class HybridViewModelInstanceSpec; } @@ -20,7 +20,7 @@ namespace margelo::nitro::rive { class HybridViewModelInstanceSpec; } #include "HybridViewModelInstanceSpec.hpp" #include -#include "Rive-Swift-Cxx-Umbrella.hpp" +#include "react_native_rive-Swift-Cxx-Umbrella.hpp" namespace margelo::nitro::rive { @@ -37,13 +37,13 @@ namespace margelo::nitro::rive { class HybridViewModelSpecSwift: public virtual HybridViewModelSpec { public: // Constructor from a Swift instance - explicit HybridViewModelSpecSwift(const Rive::HybridViewModelSpec_cxx& swiftPart): + explicit HybridViewModelSpecSwift(const react_native_rive::HybridViewModelSpec_cxx& swiftPart): HybridObject(HybridViewModelSpec::TAG), _swiftPart(swiftPart) { } public: // Get the Swift part - inline Rive::HybridViewModelSpec_cxx& getSwiftPart() noexcept { + inline react_native_rive::HybridViewModelSpec_cxx& getSwiftPart() noexcept { return _swiftPart; } @@ -107,7 +107,7 @@ namespace margelo::nitro::rive { } private: - Rive::HybridViewModelSpec_cxx _swiftPart; + react_native_rive::HybridViewModelSpec_cxx _swiftPart; }; } // namespace margelo::nitro::rive diff --git a/nitrogen/generated/ios/c++/HybridViewModelStringPropertySpecSwift.hpp b/nitrogen/generated/ios/c++/HybridViewModelStringPropertySpecSwift.hpp index 33e421af..ff4d125b 100644 --- a/nitrogen/generated/ios/c++/HybridViewModelStringPropertySpecSwift.hpp +++ b/nitrogen/generated/ios/c++/HybridViewModelStringPropertySpecSwift.hpp @@ -10,7 +10,7 @@ #include "HybridViewModelStringPropertySpec.hpp" // Forward declaration of `HybridViewModelStringPropertySpec_cxx` to properly resolve imports. -namespace Rive { class HybridViewModelStringPropertySpec_cxx; } +namespace react_native_rive { class HybridViewModelStringPropertySpec_cxx; } // Forward declaration of `HybridViewModelPropertySpecSwift` to properly resolve imports. namespace margelo::nitro::rive { class HybridViewModelPropertySpecSwift; } @@ -19,7 +19,7 @@ namespace margelo::nitro::rive { class HybridViewModelPropertySpecSwift; } #include #include "HybridViewModelPropertySpecSwift.hpp" -#include "Rive-Swift-Cxx-Umbrella.hpp" +#include "react_native_rive-Swift-Cxx-Umbrella.hpp" namespace margelo::nitro::rive { @@ -36,14 +36,14 @@ namespace margelo::nitro::rive { class HybridViewModelStringPropertySpecSwift: public virtual HybridViewModelStringPropertySpec, public virtual HybridViewModelPropertySpecSwift { public: // Constructor from a Swift instance - explicit HybridViewModelStringPropertySpecSwift(const Rive::HybridViewModelStringPropertySpec_cxx& swiftPart): + explicit HybridViewModelStringPropertySpecSwift(const react_native_rive::HybridViewModelStringPropertySpec_cxx& swiftPart): HybridObject(HybridViewModelStringPropertySpec::TAG), HybridViewModelPropertySpecSwift(swiftPart), _swiftPart(swiftPart) { } public: // Get the Swift part - inline Rive::HybridViewModelStringPropertySpec_cxx& getSwiftPart() noexcept { + inline react_native_rive::HybridViewModelStringPropertySpec_cxx& getSwiftPart() noexcept { return _swiftPart; } @@ -84,7 +84,7 @@ namespace margelo::nitro::rive { } private: - Rive::HybridViewModelStringPropertySpec_cxx _swiftPart; + react_native_rive::HybridViewModelStringPropertySpec_cxx _swiftPart; }; } // namespace margelo::nitro::rive diff --git a/nitrogen/generated/ios/c++/HybridViewModelTriggerPropertySpecSwift.hpp b/nitrogen/generated/ios/c++/HybridViewModelTriggerPropertySpecSwift.hpp index 906190a3..e147f2f1 100644 --- a/nitrogen/generated/ios/c++/HybridViewModelTriggerPropertySpecSwift.hpp +++ b/nitrogen/generated/ios/c++/HybridViewModelTriggerPropertySpecSwift.hpp @@ -10,7 +10,7 @@ #include "HybridViewModelTriggerPropertySpec.hpp" // Forward declaration of `HybridViewModelTriggerPropertySpec_cxx` to properly resolve imports. -namespace Rive { class HybridViewModelTriggerPropertySpec_cxx; } +namespace react_native_rive { class HybridViewModelTriggerPropertySpec_cxx; } // Forward declaration of `HybridViewModelPropertySpecSwift` to properly resolve imports. namespace margelo::nitro::rive { class HybridViewModelPropertySpecSwift; } @@ -18,7 +18,7 @@ namespace margelo::nitro::rive { class HybridViewModelPropertySpecSwift; } #include #include "HybridViewModelPropertySpecSwift.hpp" -#include "Rive-Swift-Cxx-Umbrella.hpp" +#include "react_native_rive-Swift-Cxx-Umbrella.hpp" namespace margelo::nitro::rive { @@ -35,14 +35,14 @@ namespace margelo::nitro::rive { class HybridViewModelTriggerPropertySpecSwift: public virtual HybridViewModelTriggerPropertySpec, public virtual HybridViewModelPropertySpecSwift { public: // Constructor from a Swift instance - explicit HybridViewModelTriggerPropertySpecSwift(const Rive::HybridViewModelTriggerPropertySpec_cxx& swiftPart): + explicit HybridViewModelTriggerPropertySpecSwift(const react_native_rive::HybridViewModelTriggerPropertySpec_cxx& swiftPart): HybridObject(HybridViewModelTriggerPropertySpec::TAG), HybridViewModelPropertySpecSwift(swiftPart), _swiftPart(swiftPart) { } public: // Get the Swift part - inline Rive::HybridViewModelTriggerPropertySpec_cxx& getSwiftPart() noexcept { + inline react_native_rive::HybridViewModelTriggerPropertySpec_cxx& getSwiftPart() noexcept { return _swiftPart; } @@ -83,7 +83,7 @@ namespace margelo::nitro::rive { } private: - Rive::HybridViewModelTriggerPropertySpec_cxx _swiftPart; + react_native_rive::HybridViewModelTriggerPropertySpec_cxx _swiftPart; }; } // namespace margelo::nitro::rive diff --git a/nitrogen/generated/ios/c++/views/HybridRiveViewComponent.mm b/nitrogen/generated/ios/c++/views/HybridRiveViewComponent.mm index 912bd2ca..d951553c 100644 --- a/nitrogen/generated/ios/c++/views/HybridRiveViewComponent.mm +++ b/nitrogen/generated/ios/c++/views/HybridRiveViewComponent.mm @@ -15,7 +15,7 @@ #import #import "HybridRiveViewSpecSwift.hpp" -#import "Rive-Swift-Cxx-Umbrella.hpp" +#import "react_native_rive-Swift-Cxx-Umbrella.hpp" using namespace facebook; using namespace margelo::nitro::rive; @@ -42,7 +42,7 @@ + (void) load { - (instancetype) init { if (self = [super init]) { - std::shared_ptr hybridView = Rive::RiveAutolinking::createRiveView(); + std::shared_ptr hybridView = react_native_rive::react_native_riveAutolinking::createRiveView(); _hybridView = std::dynamic_pointer_cast(hybridView); [self updateView]; } @@ -51,7 +51,7 @@ - (instancetype) init { - (void) updateView { // 1. Get Swift part - Rive::HybridRiveViewSpec_cxx& swiftPart = _hybridView->getSwiftPart(); + react_native_rive::HybridRiveViewSpec_cxx& swiftPart = _hybridView->getSwiftPart(); // 2. Get UIView* void* viewUnsafe = swiftPart.getView(); @@ -66,7 +66,7 @@ - (void) updateProps:(const std::shared_ptr&)props // 1. Downcast props const auto& newViewPropsConst = *std::static_pointer_cast(props); auto& newViewProps = const_cast(newViewPropsConst); - Rive::HybridRiveViewSpec_cxx& swiftPart = _hybridView->getSwiftPart(); + react_native_rive::HybridRiveViewSpec_cxx& swiftPart = _hybridView->getSwiftPart(); // 2. Update each prop individually swiftPart.beforeUpdate(); diff --git a/nitrogen/generated/ios/Rive+autolinking.rb b/nitrogen/generated/ios/react_native_rive+autolinking.rb similarity index 87% rename from nitrogen/generated/ios/Rive+autolinking.rb rename to nitrogen/generated/ios/react_native_rive+autolinking.rb index 1c13c510..a5ccfcac 100644 --- a/nitrogen/generated/ios/Rive+autolinking.rb +++ b/nitrogen/generated/ios/react_native_rive+autolinking.rb @@ -1,5 +1,5 @@ # -# Rive+autolinking.rb +# react_native_rive+autolinking.rb # This file was generated by nitrogen. DO NOT MODIFY THIS FILE. # https://github.com/mrousavy/nitro # Copyright © 2025 Marc Rousavy @ Margelo @@ -14,13 +14,13 @@ # # ... # # # Add all files generated by Nitrogen -# load 'nitrogen/generated/ios/Rive+autolinking.rb' +# load 'nitrogen/generated/ios/react_native_rive+autolinking.rb' # add_nitrogen_files(spec) # end # ``` def add_nitrogen_files(spec) - Pod::UI.puts "[NitroModules] 🔥 Rive is boosted by nitro!" + Pod::UI.puts "[NitroModules] 🔥 react_native_rive is boosted by nitro!" spec.dependency "NitroModules" @@ -37,7 +37,7 @@ def add_nitrogen_files(spec) # Generated specs "nitrogen/generated/shared/**/*.{h,hpp}", # Swift to C++ bridging helpers - "nitrogen/generated/ios/Rive-Swift-Cxx-Bridge.hpp" + "nitrogen/generated/ios/react_native_rive-Swift-Cxx-Bridge.hpp" ] current_private_header_files = Array(spec.attributes_hash['private_header_files']) diff --git a/nitrogen/generated/ios/Rive-Swift-Cxx-Bridge.cpp b/nitrogen/generated/ios/react_native_rive-Swift-Cxx-Bridge.cpp similarity index 78% rename from nitrogen/generated/ios/Rive-Swift-Cxx-Bridge.cpp rename to nitrogen/generated/ios/react_native_rive-Swift-Cxx-Bridge.cpp index e1281ab1..397c3ee6 100644 --- a/nitrogen/generated/ios/Rive-Swift-Cxx-Bridge.cpp +++ b/nitrogen/generated/ios/react_native_rive-Swift-Cxx-Bridge.cpp @@ -1,11 +1,11 @@ /// -/// Rive-Swift-Cxx-Bridge.cpp +/// react_native_rive-Swift-Cxx-Bridge.cpp /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. /// https://github.com/mrousavy/nitro /// Copyright © 2025 Marc Rousavy @ Margelo /// -#include "Rive-Swift-Cxx-Bridge.hpp" +#include "react_native_rive-Swift-Cxx-Bridge.hpp" // Include C++ implementation defined types #include "HybridRiveFileFactorySpecSwift.hpp" @@ -21,13 +21,13 @@ #include "HybridViewModelSpecSwift.hpp" #include "HybridViewModelStringPropertySpecSwift.hpp" #include "HybridViewModelTriggerPropertySpecSwift.hpp" -#include "Rive-Swift-Cxx-Umbrella.hpp" +#include "react_native_rive-Swift-Cxx-Umbrella.hpp" namespace margelo::nitro::rive::bridge::swift { // pragma MARK: std::shared_ptr std::shared_ptr create_std__shared_ptr_HybridRiveSpec_(void* NON_NULL swiftUnsafePointer) noexcept { - Rive::HybridRiveSpec_cxx swiftPart = Rive::HybridRiveSpec_cxx::fromUnsafe(swiftUnsafePointer); + react_native_rive::HybridRiveSpec_cxx swiftPart = react_native_rive::HybridRiveSpec_cxx::fromUnsafe(swiftUnsafePointer); return std::make_shared(swiftPart); } void* NON_NULL get_std__shared_ptr_HybridRiveSpec_(std__shared_ptr_HybridRiveSpec_ cppType) { @@ -37,13 +37,13 @@ namespace margelo::nitro::rive::bridge::swift { throw std::runtime_error("Class \"HybridRiveSpec\" is not implemented in Swift!"); } #endif - Rive::HybridRiveSpec_cxx& swiftPart = swiftWrapper->getSwiftPart(); + react_native_rive::HybridRiveSpec_cxx& swiftPart = swiftWrapper->getSwiftPart(); return swiftPart.toUnsafe(); } // pragma MARK: std::shared_ptr std::shared_ptr create_std__shared_ptr_HybridViewModelSpec_(void* NON_NULL swiftUnsafePointer) noexcept { - Rive::HybridViewModelSpec_cxx swiftPart = Rive::HybridViewModelSpec_cxx::fromUnsafe(swiftUnsafePointer); + react_native_rive::HybridViewModelSpec_cxx swiftPart = react_native_rive::HybridViewModelSpec_cxx::fromUnsafe(swiftUnsafePointer); return std::make_shared(swiftPart); } void* NON_NULL get_std__shared_ptr_HybridViewModelSpec_(std__shared_ptr_HybridViewModelSpec_ cppType) { @@ -53,13 +53,13 @@ namespace margelo::nitro::rive::bridge::swift { throw std::runtime_error("Class \"HybridViewModelSpec\" is not implemented in Swift!"); } #endif - Rive::HybridViewModelSpec_cxx& swiftPart = swiftWrapper->getSwiftPart(); + react_native_rive::HybridViewModelSpec_cxx& swiftPart = swiftWrapper->getSwiftPart(); return swiftPart.toUnsafe(); } // pragma MARK: std::shared_ptr std::shared_ptr create_std__shared_ptr_HybridRiveFileSpec_(void* NON_NULL swiftUnsafePointer) noexcept { - Rive::HybridRiveFileSpec_cxx swiftPart = Rive::HybridRiveFileSpec_cxx::fromUnsafe(swiftUnsafePointer); + react_native_rive::HybridRiveFileSpec_cxx swiftPart = react_native_rive::HybridRiveFileSpec_cxx::fromUnsafe(swiftUnsafePointer); return std::make_shared(swiftPart); } void* NON_NULL get_std__shared_ptr_HybridRiveFileSpec_(std__shared_ptr_HybridRiveFileSpec_ cppType) { @@ -69,13 +69,13 @@ namespace margelo::nitro::rive::bridge::swift { throw std::runtime_error("Class \"HybridRiveFileSpec\" is not implemented in Swift!"); } #endif - Rive::HybridRiveFileSpec_cxx& swiftPart = swiftWrapper->getSwiftPart(); + react_native_rive::HybridRiveFileSpec_cxx& swiftPart = swiftWrapper->getSwiftPart(); return swiftPart.toUnsafe(); } // pragma MARK: std::function& /* result */)> Func_void_std__shared_ptr_HybridRiveFileSpec_ create_Func_void_std__shared_ptr_HybridRiveFileSpec_(void* NON_NULL swiftClosureWrapper) noexcept { - auto swiftClosure = Rive::Func_void_std__shared_ptr_HybridRiveFileSpec_::fromUnsafe(swiftClosureWrapper); + auto swiftClosure = react_native_rive::Func_void_std__shared_ptr_HybridRiveFileSpec_::fromUnsafe(swiftClosureWrapper); return [swiftClosure = std::move(swiftClosure)](const std::shared_ptr& result) mutable -> void { swiftClosure.call(result); }; @@ -83,7 +83,7 @@ namespace margelo::nitro::rive::bridge::swift { // pragma MARK: std::function Func_void_std__exception_ptr create_Func_void_std__exception_ptr(void* NON_NULL swiftClosureWrapper) noexcept { - auto swiftClosure = Rive::Func_void_std__exception_ptr::fromUnsafe(swiftClosureWrapper); + auto swiftClosure = react_native_rive::Func_void_std__exception_ptr::fromUnsafe(swiftClosureWrapper); return [swiftClosure = std::move(swiftClosure)](const std::exception_ptr& error) mutable -> void { swiftClosure.call(error); }; @@ -91,7 +91,7 @@ namespace margelo::nitro::rive::bridge::swift { // pragma MARK: std::shared_ptr std::shared_ptr create_std__shared_ptr_HybridRiveFileFactorySpec_(void* NON_NULL swiftUnsafePointer) noexcept { - Rive::HybridRiveFileFactorySpec_cxx swiftPart = Rive::HybridRiveFileFactorySpec_cxx::fromUnsafe(swiftUnsafePointer); + react_native_rive::HybridRiveFileFactorySpec_cxx swiftPart = react_native_rive::HybridRiveFileFactorySpec_cxx::fromUnsafe(swiftUnsafePointer); return std::make_shared(swiftPart); } void* NON_NULL get_std__shared_ptr_HybridRiveFileFactorySpec_(std__shared_ptr_HybridRiveFileFactorySpec_ cppType) { @@ -101,13 +101,13 @@ namespace margelo::nitro::rive::bridge::swift { throw std::runtime_error("Class \"HybridRiveFileFactorySpec\" is not implemented in Swift!"); } #endif - Rive::HybridRiveFileFactorySpec_cxx& swiftPart = swiftWrapper->getSwiftPart(); + react_native_rive::HybridRiveFileFactorySpec_cxx& swiftPart = swiftWrapper->getSwiftPart(); return swiftPart.toUnsafe(); } // pragma MARK: std::shared_ptr std::shared_ptr create_std__shared_ptr_HybridViewModelInstanceSpec_(void* NON_NULL swiftUnsafePointer) noexcept { - Rive::HybridViewModelInstanceSpec_cxx swiftPart = Rive::HybridViewModelInstanceSpec_cxx::fromUnsafe(swiftUnsafePointer); + react_native_rive::HybridViewModelInstanceSpec_cxx swiftPart = react_native_rive::HybridViewModelInstanceSpec_cxx::fromUnsafe(swiftUnsafePointer); return std::make_shared(swiftPart); } void* NON_NULL get_std__shared_ptr_HybridViewModelInstanceSpec_(std__shared_ptr_HybridViewModelInstanceSpec_ cppType) { @@ -117,7 +117,7 @@ namespace margelo::nitro::rive::bridge::swift { throw std::runtime_error("Class \"HybridViewModelInstanceSpec\" is not implemented in Swift!"); } #endif - Rive::HybridViewModelInstanceSpec_cxx& swiftPart = swiftWrapper->getSwiftPart(); + react_native_rive::HybridViewModelInstanceSpec_cxx& swiftPart = swiftWrapper->getSwiftPart(); return swiftPart.toUnsafe(); } @@ -131,7 +131,7 @@ namespace margelo::nitro::rive::bridge::swift { // pragma MARK: std::function Func_void_bool create_Func_void_bool(void* NON_NULL swiftClosureWrapper) noexcept { - auto swiftClosure = Rive::Func_void_bool::fromUnsafe(swiftClosureWrapper); + auto swiftClosure = react_native_rive::Func_void_bool::fromUnsafe(swiftClosureWrapper); return [swiftClosure = std::move(swiftClosure)](bool result) mutable -> void { swiftClosure.call(result); }; @@ -139,7 +139,7 @@ namespace margelo::nitro::rive::bridge::swift { // pragma MARK: std::function Func_void_UnifiedRiveEvent create_Func_void_UnifiedRiveEvent(void* NON_NULL swiftClosureWrapper) noexcept { - auto swiftClosure = Rive::Func_void_UnifiedRiveEvent::fromUnsafe(swiftClosureWrapper); + auto swiftClosure = react_native_rive::Func_void_UnifiedRiveEvent::fromUnsafe(swiftClosureWrapper); return [swiftClosure = std::move(swiftClosure)](const UnifiedRiveEvent& event) mutable -> void { swiftClosure.call(event); }; @@ -147,7 +147,7 @@ namespace margelo::nitro::rive::bridge::swift { // pragma MARK: std::shared_ptr std::shared_ptr create_std__shared_ptr_HybridRiveViewSpec_(void* NON_NULL swiftUnsafePointer) noexcept { - Rive::HybridRiveViewSpec_cxx swiftPart = Rive::HybridRiveViewSpec_cxx::fromUnsafe(swiftUnsafePointer); + react_native_rive::HybridRiveViewSpec_cxx swiftPart = react_native_rive::HybridRiveViewSpec_cxx::fromUnsafe(swiftUnsafePointer); return std::make_shared(swiftPart); } void* NON_NULL get_std__shared_ptr_HybridRiveViewSpec_(std__shared_ptr_HybridRiveViewSpec_ cppType) { @@ -157,13 +157,13 @@ namespace margelo::nitro::rive::bridge::swift { throw std::runtime_error("Class \"HybridRiveViewSpec\" is not implemented in Swift!"); } #endif - Rive::HybridRiveViewSpec_cxx& swiftPart = swiftWrapper->getSwiftPart(); + react_native_rive::HybridRiveViewSpec_cxx& swiftPart = swiftWrapper->getSwiftPart(); return swiftPart.toUnsafe(); } // pragma MARK: std::shared_ptr std::shared_ptr create_std__shared_ptr_HybridViewModelPropertySpec_(void* NON_NULL swiftUnsafePointer) noexcept { - Rive::HybridViewModelPropertySpec_cxx swiftPart = Rive::HybridViewModelPropertySpec_cxx::fromUnsafe(swiftUnsafePointer); + react_native_rive::HybridViewModelPropertySpec_cxx swiftPart = react_native_rive::HybridViewModelPropertySpec_cxx::fromUnsafe(swiftUnsafePointer); return std::make_shared(swiftPart); } void* NON_NULL get_std__shared_ptr_HybridViewModelPropertySpec_(std__shared_ptr_HybridViewModelPropertySpec_ cppType) { @@ -173,13 +173,13 @@ namespace margelo::nitro::rive::bridge::swift { throw std::runtime_error("Class \"HybridViewModelPropertySpec\" is not implemented in Swift!"); } #endif - Rive::HybridViewModelPropertySpec_cxx& swiftPart = swiftWrapper->getSwiftPart(); + react_native_rive::HybridViewModelPropertySpec_cxx& swiftPart = swiftWrapper->getSwiftPart(); return swiftPart.toUnsafe(); } // pragma MARK: std::shared_ptr std::shared_ptr create_std__shared_ptr_HybridViewModelNumberPropertySpec_(void* NON_NULL swiftUnsafePointer) noexcept { - Rive::HybridViewModelNumberPropertySpec_cxx swiftPart = Rive::HybridViewModelNumberPropertySpec_cxx::fromUnsafe(swiftUnsafePointer); + react_native_rive::HybridViewModelNumberPropertySpec_cxx swiftPart = react_native_rive::HybridViewModelNumberPropertySpec_cxx::fromUnsafe(swiftUnsafePointer); return std::make_shared(swiftPart); } void* NON_NULL get_std__shared_ptr_HybridViewModelNumberPropertySpec_(std__shared_ptr_HybridViewModelNumberPropertySpec_ cppType) { @@ -189,13 +189,13 @@ namespace margelo::nitro::rive::bridge::swift { throw std::runtime_error("Class \"HybridViewModelNumberPropertySpec\" is not implemented in Swift!"); } #endif - Rive::HybridViewModelNumberPropertySpec_cxx& swiftPart = swiftWrapper->getSwiftPart(); + react_native_rive::HybridViewModelNumberPropertySpec_cxx& swiftPart = swiftWrapper->getSwiftPart(); return swiftPart.toUnsafe(); } // pragma MARK: std::shared_ptr std::shared_ptr create_std__shared_ptr_HybridViewModelStringPropertySpec_(void* NON_NULL swiftUnsafePointer) noexcept { - Rive::HybridViewModelStringPropertySpec_cxx swiftPart = Rive::HybridViewModelStringPropertySpec_cxx::fromUnsafe(swiftUnsafePointer); + react_native_rive::HybridViewModelStringPropertySpec_cxx swiftPart = react_native_rive::HybridViewModelStringPropertySpec_cxx::fromUnsafe(swiftUnsafePointer); return std::make_shared(swiftPart); } void* NON_NULL get_std__shared_ptr_HybridViewModelStringPropertySpec_(std__shared_ptr_HybridViewModelStringPropertySpec_ cppType) { @@ -205,13 +205,13 @@ namespace margelo::nitro::rive::bridge::swift { throw std::runtime_error("Class \"HybridViewModelStringPropertySpec\" is not implemented in Swift!"); } #endif - Rive::HybridViewModelStringPropertySpec_cxx& swiftPart = swiftWrapper->getSwiftPart(); + react_native_rive::HybridViewModelStringPropertySpec_cxx& swiftPart = swiftWrapper->getSwiftPart(); return swiftPart.toUnsafe(); } // pragma MARK: std::shared_ptr std::shared_ptr create_std__shared_ptr_HybridViewModelBooleanPropertySpec_(void* NON_NULL swiftUnsafePointer) noexcept { - Rive::HybridViewModelBooleanPropertySpec_cxx swiftPart = Rive::HybridViewModelBooleanPropertySpec_cxx::fromUnsafe(swiftUnsafePointer); + react_native_rive::HybridViewModelBooleanPropertySpec_cxx swiftPart = react_native_rive::HybridViewModelBooleanPropertySpec_cxx::fromUnsafe(swiftUnsafePointer); return std::make_shared(swiftPart); } void* NON_NULL get_std__shared_ptr_HybridViewModelBooleanPropertySpec_(std__shared_ptr_HybridViewModelBooleanPropertySpec_ cppType) { @@ -221,13 +221,13 @@ namespace margelo::nitro::rive::bridge::swift { throw std::runtime_error("Class \"HybridViewModelBooleanPropertySpec\" is not implemented in Swift!"); } #endif - Rive::HybridViewModelBooleanPropertySpec_cxx& swiftPart = swiftWrapper->getSwiftPart(); + react_native_rive::HybridViewModelBooleanPropertySpec_cxx& swiftPart = swiftWrapper->getSwiftPart(); return swiftPart.toUnsafe(); } // pragma MARK: std::shared_ptr std::shared_ptr create_std__shared_ptr_HybridViewModelColorPropertySpec_(void* NON_NULL swiftUnsafePointer) noexcept { - Rive::HybridViewModelColorPropertySpec_cxx swiftPart = Rive::HybridViewModelColorPropertySpec_cxx::fromUnsafe(swiftUnsafePointer); + react_native_rive::HybridViewModelColorPropertySpec_cxx swiftPart = react_native_rive::HybridViewModelColorPropertySpec_cxx::fromUnsafe(swiftUnsafePointer); return std::make_shared(swiftPart); } void* NON_NULL get_std__shared_ptr_HybridViewModelColorPropertySpec_(std__shared_ptr_HybridViewModelColorPropertySpec_ cppType) { @@ -237,13 +237,13 @@ namespace margelo::nitro::rive::bridge::swift { throw std::runtime_error("Class \"HybridViewModelColorPropertySpec\" is not implemented in Swift!"); } #endif - Rive::HybridViewModelColorPropertySpec_cxx& swiftPart = swiftWrapper->getSwiftPart(); + react_native_rive::HybridViewModelColorPropertySpec_cxx& swiftPart = swiftWrapper->getSwiftPart(); return swiftPart.toUnsafe(); } // pragma MARK: std::shared_ptr std::shared_ptr create_std__shared_ptr_HybridViewModelEnumPropertySpec_(void* NON_NULL swiftUnsafePointer) noexcept { - Rive::HybridViewModelEnumPropertySpec_cxx swiftPart = Rive::HybridViewModelEnumPropertySpec_cxx::fromUnsafe(swiftUnsafePointer); + react_native_rive::HybridViewModelEnumPropertySpec_cxx swiftPart = react_native_rive::HybridViewModelEnumPropertySpec_cxx::fromUnsafe(swiftUnsafePointer); return std::make_shared(swiftPart); } void* NON_NULL get_std__shared_ptr_HybridViewModelEnumPropertySpec_(std__shared_ptr_HybridViewModelEnumPropertySpec_ cppType) { @@ -253,13 +253,13 @@ namespace margelo::nitro::rive::bridge::swift { throw std::runtime_error("Class \"HybridViewModelEnumPropertySpec\" is not implemented in Swift!"); } #endif - Rive::HybridViewModelEnumPropertySpec_cxx& swiftPart = swiftWrapper->getSwiftPart(); + react_native_rive::HybridViewModelEnumPropertySpec_cxx& swiftPart = swiftWrapper->getSwiftPart(); return swiftPart.toUnsafe(); } // pragma MARK: std::shared_ptr std::shared_ptr create_std__shared_ptr_HybridViewModelTriggerPropertySpec_(void* NON_NULL swiftUnsafePointer) noexcept { - Rive::HybridViewModelTriggerPropertySpec_cxx swiftPart = Rive::HybridViewModelTriggerPropertySpec_cxx::fromUnsafe(swiftUnsafePointer); + react_native_rive::HybridViewModelTriggerPropertySpec_cxx swiftPart = react_native_rive::HybridViewModelTriggerPropertySpec_cxx::fromUnsafe(swiftUnsafePointer); return std::make_shared(swiftPart); } void* NON_NULL get_std__shared_ptr_HybridViewModelTriggerPropertySpec_(std__shared_ptr_HybridViewModelTriggerPropertySpec_ cppType) { @@ -269,13 +269,13 @@ namespace margelo::nitro::rive::bridge::swift { throw std::runtime_error("Class \"HybridViewModelTriggerPropertySpec\" is not implemented in Swift!"); } #endif - Rive::HybridViewModelTriggerPropertySpec_cxx& swiftPart = swiftWrapper->getSwiftPart(); + react_native_rive::HybridViewModelTriggerPropertySpec_cxx& swiftPart = swiftWrapper->getSwiftPart(); return swiftPart.toUnsafe(); } // pragma MARK: std::function Func_void_double create_Func_void_double(void* NON_NULL swiftClosureWrapper) noexcept { - auto swiftClosure = Rive::Func_void_double::fromUnsafe(swiftClosureWrapper); + auto swiftClosure = react_native_rive::Func_void_double::fromUnsafe(swiftClosureWrapper); return [swiftClosure = std::move(swiftClosure)](double value) mutable -> void { swiftClosure.call(value); }; @@ -283,7 +283,7 @@ namespace margelo::nitro::rive::bridge::swift { // pragma MARK: std::function Func_void_std__string create_Func_void_std__string(void* NON_NULL swiftClosureWrapper) noexcept { - auto swiftClosure = Rive::Func_void_std__string::fromUnsafe(swiftClosureWrapper); + auto swiftClosure = react_native_rive::Func_void_std__string::fromUnsafe(swiftClosureWrapper); return [swiftClosure = std::move(swiftClosure)](const std::string& value) mutable -> void { swiftClosure.call(value); }; @@ -291,7 +291,7 @@ namespace margelo::nitro::rive::bridge::swift { // pragma MARK: std::function Func_void create_Func_void(void* NON_NULL swiftClosureWrapper) noexcept { - auto swiftClosure = Rive::Func_void::fromUnsafe(swiftClosureWrapper); + auto swiftClosure = react_native_rive::Func_void::fromUnsafe(swiftClosureWrapper); return [swiftClosure = std::move(swiftClosure)]() mutable -> void { swiftClosure.call(); }; diff --git a/nitrogen/generated/ios/Rive-Swift-Cxx-Bridge.hpp b/nitrogen/generated/ios/react_native_rive-Swift-Cxx-Bridge.hpp similarity index 98% rename from nitrogen/generated/ios/Rive-Swift-Cxx-Bridge.hpp rename to nitrogen/generated/ios/react_native_rive-Swift-Cxx-Bridge.hpp index cbf738c5..36218aaf 100644 --- a/nitrogen/generated/ios/Rive-Swift-Cxx-Bridge.hpp +++ b/nitrogen/generated/ios/react_native_rive-Swift-Cxx-Bridge.hpp @@ -1,5 +1,5 @@ /// -/// Rive-Swift-Cxx-Bridge.hpp +/// react_native_rive-Swift-Cxx-Bridge.hpp /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. /// https://github.com/mrousavy/nitro /// Copyright © 2025 Marc Rousavy @ Margelo @@ -61,31 +61,31 @@ namespace margelo::nitro::rive { struct UnifiedRiveEvent; } // Forward declarations of Swift defined types // Forward declaration of `HybridRiveFileFactorySpec_cxx` to properly resolve imports. -namespace Rive { class HybridRiveFileFactorySpec_cxx; } +namespace react_native_rive { class HybridRiveFileFactorySpec_cxx; } // Forward declaration of `HybridRiveFileSpec_cxx` to properly resolve imports. -namespace Rive { class HybridRiveFileSpec_cxx; } +namespace react_native_rive { class HybridRiveFileSpec_cxx; } // Forward declaration of `HybridRiveSpec_cxx` to properly resolve imports. -namespace Rive { class HybridRiveSpec_cxx; } +namespace react_native_rive { class HybridRiveSpec_cxx; } // Forward declaration of `HybridRiveViewSpec_cxx` to properly resolve imports. -namespace Rive { class HybridRiveViewSpec_cxx; } +namespace react_native_rive { class HybridRiveViewSpec_cxx; } // Forward declaration of `HybridViewModelBooleanPropertySpec_cxx` to properly resolve imports. -namespace Rive { class HybridViewModelBooleanPropertySpec_cxx; } +namespace react_native_rive { class HybridViewModelBooleanPropertySpec_cxx; } // Forward declaration of `HybridViewModelColorPropertySpec_cxx` to properly resolve imports. -namespace Rive { class HybridViewModelColorPropertySpec_cxx; } +namespace react_native_rive { class HybridViewModelColorPropertySpec_cxx; } // Forward declaration of `HybridViewModelEnumPropertySpec_cxx` to properly resolve imports. -namespace Rive { class HybridViewModelEnumPropertySpec_cxx; } +namespace react_native_rive { class HybridViewModelEnumPropertySpec_cxx; } // Forward declaration of `HybridViewModelInstanceSpec_cxx` to properly resolve imports. -namespace Rive { class HybridViewModelInstanceSpec_cxx; } +namespace react_native_rive { class HybridViewModelInstanceSpec_cxx; } // Forward declaration of `HybridViewModelNumberPropertySpec_cxx` to properly resolve imports. -namespace Rive { class HybridViewModelNumberPropertySpec_cxx; } +namespace react_native_rive { class HybridViewModelNumberPropertySpec_cxx; } // Forward declaration of `HybridViewModelPropertySpec_cxx` to properly resolve imports. -namespace Rive { class HybridViewModelPropertySpec_cxx; } +namespace react_native_rive { class HybridViewModelPropertySpec_cxx; } // Forward declaration of `HybridViewModelSpec_cxx` to properly resolve imports. -namespace Rive { class HybridViewModelSpec_cxx; } +namespace react_native_rive { class HybridViewModelSpec_cxx; } // Forward declaration of `HybridViewModelStringPropertySpec_cxx` to properly resolve imports. -namespace Rive { class HybridViewModelStringPropertySpec_cxx; } +namespace react_native_rive { class HybridViewModelStringPropertySpec_cxx; } // Forward declaration of `HybridViewModelTriggerPropertySpec_cxx` to properly resolve imports. -namespace Rive { class HybridViewModelTriggerPropertySpec_cxx; } +namespace react_native_rive { class HybridViewModelTriggerPropertySpec_cxx; } // Include C++ defined types #include "Alignment.hpp" diff --git a/nitrogen/generated/ios/Rive-Swift-Cxx-Umbrella.hpp b/nitrogen/generated/ios/react_native_rive-Swift-Cxx-Umbrella.hpp similarity index 82% rename from nitrogen/generated/ios/Rive-Swift-Cxx-Umbrella.hpp rename to nitrogen/generated/ios/react_native_rive-Swift-Cxx-Umbrella.hpp index 208b986f..a6540a2d 100644 --- a/nitrogen/generated/ios/Rive-Swift-Cxx-Umbrella.hpp +++ b/nitrogen/generated/ios/react_native_rive-Swift-Cxx-Umbrella.hpp @@ -1,5 +1,5 @@ /// -/// Rive-Swift-Cxx-Umbrella.hpp +/// react_native_rive-Swift-Cxx-Umbrella.hpp /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. /// https://github.com/mrousavy/nitro /// Copyright © 2025 Marc Rousavy @ Margelo @@ -97,7 +97,7 @@ namespace margelo::nitro::rive { struct UnifiedRiveEvent; } #include // C++ helpers for Swift -#include "Rive-Swift-Cxx-Bridge.hpp" +#include "react_native_rive-Swift-Cxx-Bridge.hpp" // Common C++ types used in Swift #include @@ -107,40 +107,40 @@ namespace margelo::nitro::rive { struct UnifiedRiveEvent; } // Forward declarations of Swift defined types // Forward declaration of `HybridRiveFileFactorySpec_cxx` to properly resolve imports. -namespace Rive { class HybridRiveFileFactorySpec_cxx; } +namespace react_native_rive { class HybridRiveFileFactorySpec_cxx; } // Forward declaration of `HybridRiveFileSpec_cxx` to properly resolve imports. -namespace Rive { class HybridRiveFileSpec_cxx; } +namespace react_native_rive { class HybridRiveFileSpec_cxx; } // Forward declaration of `HybridRiveSpec_cxx` to properly resolve imports. -namespace Rive { class HybridRiveSpec_cxx; } +namespace react_native_rive { class HybridRiveSpec_cxx; } // Forward declaration of `HybridRiveViewSpec_cxx` to properly resolve imports. -namespace Rive { class HybridRiveViewSpec_cxx; } +namespace react_native_rive { class HybridRiveViewSpec_cxx; } // Forward declaration of `HybridViewModelBooleanPropertySpec_cxx` to properly resolve imports. -namespace Rive { class HybridViewModelBooleanPropertySpec_cxx; } +namespace react_native_rive { class HybridViewModelBooleanPropertySpec_cxx; } // Forward declaration of `HybridViewModelColorPropertySpec_cxx` to properly resolve imports. -namespace Rive { class HybridViewModelColorPropertySpec_cxx; } +namespace react_native_rive { class HybridViewModelColorPropertySpec_cxx; } // Forward declaration of `HybridViewModelEnumPropertySpec_cxx` to properly resolve imports. -namespace Rive { class HybridViewModelEnumPropertySpec_cxx; } +namespace react_native_rive { class HybridViewModelEnumPropertySpec_cxx; } // Forward declaration of `HybridViewModelInstanceSpec_cxx` to properly resolve imports. -namespace Rive { class HybridViewModelInstanceSpec_cxx; } +namespace react_native_rive { class HybridViewModelInstanceSpec_cxx; } // Forward declaration of `HybridViewModelNumberPropertySpec_cxx` to properly resolve imports. -namespace Rive { class HybridViewModelNumberPropertySpec_cxx; } +namespace react_native_rive { class HybridViewModelNumberPropertySpec_cxx; } // Forward declaration of `HybridViewModelPropertySpec_cxx` to properly resolve imports. -namespace Rive { class HybridViewModelPropertySpec_cxx; } +namespace react_native_rive { class HybridViewModelPropertySpec_cxx; } // Forward declaration of `HybridViewModelSpec_cxx` to properly resolve imports. -namespace Rive { class HybridViewModelSpec_cxx; } +namespace react_native_rive { class HybridViewModelSpec_cxx; } // Forward declaration of `HybridViewModelStringPropertySpec_cxx` to properly resolve imports. -namespace Rive { class HybridViewModelStringPropertySpec_cxx; } +namespace react_native_rive { class HybridViewModelStringPropertySpec_cxx; } // Forward declaration of `HybridViewModelTriggerPropertySpec_cxx` to properly resolve imports. -namespace Rive { class HybridViewModelTriggerPropertySpec_cxx; } +namespace react_native_rive { class HybridViewModelTriggerPropertySpec_cxx; } // Include Swift defined types -#if __has_include("Rive-Swift.h") +#if __has_include("react_native_rive-Swift.h") // This header is generated by Xcode/Swift on every app build. -// If it cannot be found, make sure the Swift module's name (= podspec name) is actually "Rive". -#include "Rive-Swift.h" +// If it cannot be found, make sure the Swift module's name (= podspec name) is actually "react_native_rive". +#include "react_native_rive-Swift.h" // Same as above, but used when building with frameworks (`use_frameworks`) -#elif __has_include() -#include +#elif __has_include() +#include #else -#error Rive's autogenerated Swift header cannot be found! Make sure the Swift module's name (= podspec name) is actually "Rive", and try building the app first. +#error react_native_rive's autogenerated Swift header cannot be found! Make sure the Swift module's name (= podspec name) is actually "react_native_rive", and try building the app first. #endif diff --git a/nitrogen/generated/ios/RiveAutolinking.mm b/nitrogen/generated/ios/react_native_riveAutolinking.mm similarity index 71% rename from nitrogen/generated/ios/RiveAutolinking.mm rename to nitrogen/generated/ios/react_native_riveAutolinking.mm index 8cea8cdb..638dfa72 100644 --- a/nitrogen/generated/ios/RiveAutolinking.mm +++ b/nitrogen/generated/ios/react_native_riveAutolinking.mm @@ -1,5 +1,5 @@ /// -/// RiveAutolinking.mm +/// react_native_riveAutolinking.mm /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. /// https://github.com/mrousavy/nitro /// Copyright © 2025 Marc Rousavy @ Margelo @@ -7,7 +7,7 @@ #import #import -#import "Rive-Swift-Cxx-Umbrella.hpp" +#import "react_native_rive-Swift-Cxx-Umbrella.hpp" #import #include "HybridRiveSpecSwift.hpp" @@ -23,10 +23,10 @@ #include "HybridViewModelTriggerPropertySpecSwift.hpp" #include "HybridRiveViewSpecSwift.hpp" -@interface RiveAutolinking : NSObject +@interface react_native_riveAutolinking : NSObject @end -@implementation RiveAutolinking +@implementation react_native_riveAutolinking + (void) load { using namespace margelo::nitro; @@ -35,84 +35,84 @@ + (void) load { HybridObjectRegistry::registerHybridObjectConstructor( "Rive", []() -> std::shared_ptr { - std::shared_ptr hybridObject = Rive::RiveAutolinking::createRive(); + std::shared_ptr hybridObject = react_native_rive::react_native_riveAutolinking::createRive(); return hybridObject; } ); HybridObjectRegistry::registerHybridObjectConstructor( "RiveFileFactory", []() -> std::shared_ptr { - std::shared_ptr hybridObject = Rive::RiveAutolinking::createRiveFileFactory(); + std::shared_ptr hybridObject = react_native_rive::react_native_riveAutolinking::createRiveFileFactory(); return hybridObject; } ); HybridObjectRegistry::registerHybridObjectConstructor( "RiveFile", []() -> std::shared_ptr { - std::shared_ptr hybridObject = Rive::RiveAutolinking::createRiveFile(); + std::shared_ptr hybridObject = react_native_rive::react_native_riveAutolinking::createRiveFile(); return hybridObject; } ); HybridObjectRegistry::registerHybridObjectConstructor( "ViewModel", []() -> std::shared_ptr { - std::shared_ptr hybridObject = Rive::RiveAutolinking::createViewModel(); + std::shared_ptr hybridObject = react_native_rive::react_native_riveAutolinking::createViewModel(); return hybridObject; } ); HybridObjectRegistry::registerHybridObjectConstructor( "ViewModelInstance", []() -> std::shared_ptr { - std::shared_ptr hybridObject = Rive::RiveAutolinking::createViewModelInstance(); + std::shared_ptr hybridObject = react_native_rive::react_native_riveAutolinking::createViewModelInstance(); return hybridObject; } ); HybridObjectRegistry::registerHybridObjectConstructor( "ViewModelNumberProperty", []() -> std::shared_ptr { - std::shared_ptr hybridObject = Rive::RiveAutolinking::createViewModelNumberProperty(); + std::shared_ptr hybridObject = react_native_rive::react_native_riveAutolinking::createViewModelNumberProperty(); return hybridObject; } ); HybridObjectRegistry::registerHybridObjectConstructor( "ViewModelStringProperty", []() -> std::shared_ptr { - std::shared_ptr hybridObject = Rive::RiveAutolinking::createViewModelStringProperty(); + std::shared_ptr hybridObject = react_native_rive::react_native_riveAutolinking::createViewModelStringProperty(); return hybridObject; } ); HybridObjectRegistry::registerHybridObjectConstructor( "ViewModelBooleanProperty", []() -> std::shared_ptr { - std::shared_ptr hybridObject = Rive::RiveAutolinking::createViewModelBooleanProperty(); + std::shared_ptr hybridObject = react_native_rive::react_native_riveAutolinking::createViewModelBooleanProperty(); return hybridObject; } ); HybridObjectRegistry::registerHybridObjectConstructor( "ViewModelColorProperty", []() -> std::shared_ptr { - std::shared_ptr hybridObject = Rive::RiveAutolinking::createViewModelColorProperty(); + std::shared_ptr hybridObject = react_native_rive::react_native_riveAutolinking::createViewModelColorProperty(); return hybridObject; } ); HybridObjectRegistry::registerHybridObjectConstructor( "ViewModelEnumProperty", []() -> std::shared_ptr { - std::shared_ptr hybridObject = Rive::RiveAutolinking::createViewModelEnumProperty(); + std::shared_ptr hybridObject = react_native_rive::react_native_riveAutolinking::createViewModelEnumProperty(); return hybridObject; } ); HybridObjectRegistry::registerHybridObjectConstructor( "ViewModelTriggerProperty", []() -> std::shared_ptr { - std::shared_ptr hybridObject = Rive::RiveAutolinking::createViewModelTriggerProperty(); + std::shared_ptr hybridObject = react_native_rive::react_native_riveAutolinking::createViewModelTriggerProperty(); return hybridObject; } ); HybridObjectRegistry::registerHybridObjectConstructor( "RiveView", []() -> std::shared_ptr { - std::shared_ptr hybridObject = Rive::RiveAutolinking::createRiveView(); + std::shared_ptr hybridObject = react_native_rive::react_native_riveAutolinking::createRiveView(); return hybridObject; } ); diff --git a/nitrogen/generated/ios/RiveAutolinking.swift b/nitrogen/generated/ios/react_native_riveAutolinking.swift similarity index 98% rename from nitrogen/generated/ios/RiveAutolinking.swift rename to nitrogen/generated/ios/react_native_riveAutolinking.swift index b182e00f..d138e73b 100644 --- a/nitrogen/generated/ios/RiveAutolinking.swift +++ b/nitrogen/generated/ios/react_native_riveAutolinking.swift @@ -1,11 +1,11 @@ /// -/// RiveAutolinking.swift +/// react_native_riveAutolinking.swift /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. /// https://github.com/mrousavy/nitro /// Copyright © 2025 Marc Rousavy @ Margelo /// -public final class RiveAutolinking { +public final class react_native_riveAutolinking { public typealias bridge = margelo.nitro.rive.bridge.swift /** diff --git a/nitrogen/generated/ios/swift/HybridRiveFileFactorySpec_cxx.swift b/nitrogen/generated/ios/swift/HybridRiveFileFactorySpec_cxx.swift index 7a1fd7df..cc9cdfbc 100644 --- a/nitrogen/generated/ios/swift/HybridRiveFileFactorySpec_cxx.swift +++ b/nitrogen/generated/ios/swift/HybridRiveFileFactorySpec_cxx.swift @@ -21,7 +21,7 @@ import NitroModules open class HybridRiveFileFactorySpec_cxx { /** * The Swift <> C++ bridge's namespace (`margelo::nitro::rive::bridge::swift`) - * from `Rive-Swift-Cxx-Bridge.hpp`. + * from `react_native_rive-Swift-Cxx-Bridge.hpp`. * This contains specialized C++ templates, and C++ helper functions that can be accessed from Swift. */ public typealias bridge = margelo.nitro.rive.bridge.swift diff --git a/nitrogen/generated/ios/swift/HybridRiveFileSpec_cxx.swift b/nitrogen/generated/ios/swift/HybridRiveFileSpec_cxx.swift index 210149f4..a2900a92 100644 --- a/nitrogen/generated/ios/swift/HybridRiveFileSpec_cxx.swift +++ b/nitrogen/generated/ios/swift/HybridRiveFileSpec_cxx.swift @@ -20,7 +20,7 @@ import NitroModules open class HybridRiveFileSpec_cxx { /** * The Swift <> C++ bridge's namespace (`margelo::nitro::rive::bridge::swift`) - * from `Rive-Swift-Cxx-Bridge.hpp`. + * from `react_native_rive-Swift-Cxx-Bridge.hpp`. * This contains specialized C++ templates, and C++ helper functions that can be accessed from Swift. */ public typealias bridge = margelo.nitro.rive.bridge.swift diff --git a/nitrogen/generated/ios/swift/HybridRiveSpec_cxx.swift b/nitrogen/generated/ios/swift/HybridRiveSpec_cxx.swift index baf8a25c..8f2e4cab 100644 --- a/nitrogen/generated/ios/swift/HybridRiveSpec_cxx.swift +++ b/nitrogen/generated/ios/swift/HybridRiveSpec_cxx.swift @@ -20,7 +20,7 @@ import NitroModules open class HybridRiveSpec_cxx { /** * The Swift <> C++ bridge's namespace (`margelo::nitro::rive::bridge::swift`) - * from `Rive-Swift-Cxx-Bridge.hpp`. + * from `react_native_rive-Swift-Cxx-Bridge.hpp`. * This contains specialized C++ templates, and C++ helper functions that can be accessed from Swift. */ public typealias bridge = margelo.nitro.rive.bridge.swift diff --git a/nitrogen/generated/ios/swift/HybridRiveViewSpec_cxx.swift b/nitrogen/generated/ios/swift/HybridRiveViewSpec_cxx.swift index 5c25e9a8..087d5111 100644 --- a/nitrogen/generated/ios/swift/HybridRiveViewSpec_cxx.swift +++ b/nitrogen/generated/ios/swift/HybridRiveViewSpec_cxx.swift @@ -21,7 +21,7 @@ import NitroModules open class HybridRiveViewSpec_cxx { /** * The Swift <> C++ bridge's namespace (`margelo::nitro::rive::bridge::swift`) - * from `Rive-Swift-Cxx-Bridge.hpp`. + * from `react_native_rive-Swift-Cxx-Bridge.hpp`. * This contains specialized C++ templates, and C++ helper functions that can be accessed from Swift. */ public typealias bridge = margelo.nitro.rive.bridge.swift diff --git a/nitrogen/generated/ios/swift/HybridViewModelBooleanPropertySpec_cxx.swift b/nitrogen/generated/ios/swift/HybridViewModelBooleanPropertySpec_cxx.swift index 6e2ae00b..a568b3cc 100644 --- a/nitrogen/generated/ios/swift/HybridViewModelBooleanPropertySpec_cxx.swift +++ b/nitrogen/generated/ios/swift/HybridViewModelBooleanPropertySpec_cxx.swift @@ -20,7 +20,7 @@ import NitroModules open class HybridViewModelBooleanPropertySpec_cxx : HybridViewModelPropertySpec_cxx { /** * The Swift <> C++ bridge's namespace (`margelo::nitro::rive::bridge::swift`) - * from `Rive-Swift-Cxx-Bridge.hpp`. + * from `react_native_rive-Swift-Cxx-Bridge.hpp`. * This contains specialized C++ templates, and C++ helper functions that can be accessed from Swift. */ public typealias bridge = margelo.nitro.rive.bridge.swift diff --git a/nitrogen/generated/ios/swift/HybridViewModelColorPropertySpec_cxx.swift b/nitrogen/generated/ios/swift/HybridViewModelColorPropertySpec_cxx.swift index 7d03f1ab..9180f036 100644 --- a/nitrogen/generated/ios/swift/HybridViewModelColorPropertySpec_cxx.swift +++ b/nitrogen/generated/ios/swift/HybridViewModelColorPropertySpec_cxx.swift @@ -20,7 +20,7 @@ import NitroModules open class HybridViewModelColorPropertySpec_cxx : HybridViewModelPropertySpec_cxx { /** * The Swift <> C++ bridge's namespace (`margelo::nitro::rive::bridge::swift`) - * from `Rive-Swift-Cxx-Bridge.hpp`. + * from `react_native_rive-Swift-Cxx-Bridge.hpp`. * This contains specialized C++ templates, and C++ helper functions that can be accessed from Swift. */ public typealias bridge = margelo.nitro.rive.bridge.swift diff --git a/nitrogen/generated/ios/swift/HybridViewModelEnumPropertySpec_cxx.swift b/nitrogen/generated/ios/swift/HybridViewModelEnumPropertySpec_cxx.swift index d4de4a70..a51b081e 100644 --- a/nitrogen/generated/ios/swift/HybridViewModelEnumPropertySpec_cxx.swift +++ b/nitrogen/generated/ios/swift/HybridViewModelEnumPropertySpec_cxx.swift @@ -20,7 +20,7 @@ import NitroModules open class HybridViewModelEnumPropertySpec_cxx : HybridViewModelPropertySpec_cxx { /** * The Swift <> C++ bridge's namespace (`margelo::nitro::rive::bridge::swift`) - * from `Rive-Swift-Cxx-Bridge.hpp`. + * from `react_native_rive-Swift-Cxx-Bridge.hpp`. * This contains specialized C++ templates, and C++ helper functions that can be accessed from Swift. */ public typealias bridge = margelo.nitro.rive.bridge.swift diff --git a/nitrogen/generated/ios/swift/HybridViewModelInstanceSpec_cxx.swift b/nitrogen/generated/ios/swift/HybridViewModelInstanceSpec_cxx.swift index 50a5025f..d7cf5e1f 100644 --- a/nitrogen/generated/ios/swift/HybridViewModelInstanceSpec_cxx.swift +++ b/nitrogen/generated/ios/swift/HybridViewModelInstanceSpec_cxx.swift @@ -20,7 +20,7 @@ import NitroModules open class HybridViewModelInstanceSpec_cxx { /** * The Swift <> C++ bridge's namespace (`margelo::nitro::rive::bridge::swift`) - * from `Rive-Swift-Cxx-Bridge.hpp`. + * from `react_native_rive-Swift-Cxx-Bridge.hpp`. * This contains specialized C++ templates, and C++ helper functions that can be accessed from Swift. */ public typealias bridge = margelo.nitro.rive.bridge.swift diff --git a/nitrogen/generated/ios/swift/HybridViewModelNumberPropertySpec_cxx.swift b/nitrogen/generated/ios/swift/HybridViewModelNumberPropertySpec_cxx.swift index 085bf730..62d647e8 100644 --- a/nitrogen/generated/ios/swift/HybridViewModelNumberPropertySpec_cxx.swift +++ b/nitrogen/generated/ios/swift/HybridViewModelNumberPropertySpec_cxx.swift @@ -20,7 +20,7 @@ import NitroModules open class HybridViewModelNumberPropertySpec_cxx : HybridViewModelPropertySpec_cxx { /** * The Swift <> C++ bridge's namespace (`margelo::nitro::rive::bridge::swift`) - * from `Rive-Swift-Cxx-Bridge.hpp`. + * from `react_native_rive-Swift-Cxx-Bridge.hpp`. * This contains specialized C++ templates, and C++ helper functions that can be accessed from Swift. */ public typealias bridge = margelo.nitro.rive.bridge.swift diff --git a/nitrogen/generated/ios/swift/HybridViewModelPropertySpec_cxx.swift b/nitrogen/generated/ios/swift/HybridViewModelPropertySpec_cxx.swift index 67d9a6e3..348444d1 100644 --- a/nitrogen/generated/ios/swift/HybridViewModelPropertySpec_cxx.swift +++ b/nitrogen/generated/ios/swift/HybridViewModelPropertySpec_cxx.swift @@ -20,7 +20,7 @@ import NitroModules open class HybridViewModelPropertySpec_cxx { /** * The Swift <> C++ bridge's namespace (`margelo::nitro::rive::bridge::swift`) - * from `Rive-Swift-Cxx-Bridge.hpp`. + * from `react_native_rive-Swift-Cxx-Bridge.hpp`. * This contains specialized C++ templates, and C++ helper functions that can be accessed from Swift. */ public typealias bridge = margelo.nitro.rive.bridge.swift diff --git a/nitrogen/generated/ios/swift/HybridViewModelSpec_cxx.swift b/nitrogen/generated/ios/swift/HybridViewModelSpec_cxx.swift index fd01e83c..4329def2 100644 --- a/nitrogen/generated/ios/swift/HybridViewModelSpec_cxx.swift +++ b/nitrogen/generated/ios/swift/HybridViewModelSpec_cxx.swift @@ -20,7 +20,7 @@ import NitroModules open class HybridViewModelSpec_cxx { /** * The Swift <> C++ bridge's namespace (`margelo::nitro::rive::bridge::swift`) - * from `Rive-Swift-Cxx-Bridge.hpp`. + * from `react_native_rive-Swift-Cxx-Bridge.hpp`. * This contains specialized C++ templates, and C++ helper functions that can be accessed from Swift. */ public typealias bridge = margelo.nitro.rive.bridge.swift diff --git a/nitrogen/generated/ios/swift/HybridViewModelStringPropertySpec_cxx.swift b/nitrogen/generated/ios/swift/HybridViewModelStringPropertySpec_cxx.swift index 82b8f869..c9d5142c 100644 --- a/nitrogen/generated/ios/swift/HybridViewModelStringPropertySpec_cxx.swift +++ b/nitrogen/generated/ios/swift/HybridViewModelStringPropertySpec_cxx.swift @@ -20,7 +20,7 @@ import NitroModules open class HybridViewModelStringPropertySpec_cxx : HybridViewModelPropertySpec_cxx { /** * The Swift <> C++ bridge's namespace (`margelo::nitro::rive::bridge::swift`) - * from `Rive-Swift-Cxx-Bridge.hpp`. + * from `react_native_rive-Swift-Cxx-Bridge.hpp`. * This contains specialized C++ templates, and C++ helper functions that can be accessed from Swift. */ public typealias bridge = margelo.nitro.rive.bridge.swift diff --git a/nitrogen/generated/ios/swift/HybridViewModelTriggerPropertySpec_cxx.swift b/nitrogen/generated/ios/swift/HybridViewModelTriggerPropertySpec_cxx.swift index e0e5168e..9125cee6 100644 --- a/nitrogen/generated/ios/swift/HybridViewModelTriggerPropertySpec_cxx.swift +++ b/nitrogen/generated/ios/swift/HybridViewModelTriggerPropertySpec_cxx.swift @@ -20,7 +20,7 @@ import NitroModules open class HybridViewModelTriggerPropertySpec_cxx : HybridViewModelPropertySpec_cxx { /** * The Swift <> C++ bridge's namespace (`margelo::nitro::rive::bridge::swift`) - * from `Rive-Swift-Cxx-Bridge.hpp`. + * from `react_native_rive-Swift-Cxx-Bridge.hpp`. * This contains specialized C++ templates, and C++ helper functions that can be accessed from Swift. */ public typealias bridge = margelo.nitro.rive.bridge.swift diff --git a/react-native-rive.podspec b/react_native_rive.podspec similarity index 94% rename from react-native-rive.podspec rename to react_native_rive.podspec index 126df3ca..4961eee5 100644 --- a/react-native-rive.podspec +++ b/react_native_rive.podspec @@ -31,7 +31,7 @@ end Pod::UI.puts "react-native-rive: Rive iOS SDK #{rive_ios_version}" Pod::Spec.new do |s| - s.name = "react-native-rive" + s.name = "react_native_rive" s.version = package["version"] s.summary = package["description"] s.homepage = package["homepage"] @@ -44,7 +44,7 @@ Pod::Spec.new do |s| s.source_files = "ios/**/*.{h,m,mm,swift}" s.public_header_files = ['ios/RCTSwiftLog.h'] - load 'nitrogen/generated/ios/Rive+autolinking.rb' + load 'nitrogen/generated/ios/react_native_rive+autolinking.rb' add_nitrogen_files(s) s.dependency "RiveRuntime", rive_ios_version From 5025cc9942e5871a9cfc786535bf7d2887c59e38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mikl=C3=B3s=20Fazekas?= Date: Wed, 19 Nov 2025 22:22:24 +0100 Subject: [PATCH 9/9] nitrogen --- nitrogen/generated/ios/react_native_rive-Swift-Cxx-Bridge.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nitrogen/generated/ios/react_native_rive-Swift-Cxx-Bridge.cpp b/nitrogen/generated/ios/react_native_rive-Swift-Cxx-Bridge.cpp index 397c3ee6..53079583 100644 --- a/nitrogen/generated/ios/react_native_rive-Swift-Cxx-Bridge.cpp +++ b/nitrogen/generated/ios/react_native_rive-Swift-Cxx-Bridge.cpp @@ -123,7 +123,7 @@ namespace margelo::nitro::rive::bridge::swift { // pragma MARK: std::function Func_void_RiveError create_Func_void_RiveError(void* NON_NULL swiftClosureWrapper) noexcept { - auto swiftClosure = Rive::Func_void_RiveError::fromUnsafe(swiftClosureWrapper); + auto swiftClosure = react_native_rive::Func_void_RiveError::fromUnsafe(swiftClosureWrapper); return [swiftClosure = std::move(swiftClosure)](const RiveError& error) mutable -> void { swiftClosure.call(error); };