From cd2f86308d9b035c7753ec6acab40f5b0970d7d0 Mon Sep 17 00:00:00 2001 From: contra Date: Sun, 8 Mar 2026 09:53:49 -0700 Subject: [PATCH] fix: expose unload() JSI binding for TextToImageModule MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit TextToImage.unload() exists in C++ but was never registered as a JSI host function, causing `TypeError: this.nativeModule.unload is not a function` when calling BaseModule.delete() from JS. Every other composite model (OCR, VerticalOCR, Kokoro, LLM) already registers unload in its `if constexpr` block — this adds the same one-liner for TextToImage. --- .../common/rnexecutorch/host_objects/ModelHostObject.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/react-native-executorch/common/rnexecutorch/host_objects/ModelHostObject.h b/packages/react-native-executorch/common/rnexecutorch/host_objects/ModelHostObject.h index d6489c9be..97cd023b6 100644 --- a/packages/react-native-executorch/common/rnexecutorch/host_objects/ModelHostObject.h +++ b/packages/react-native-executorch/common/rnexecutorch/host_objects/ModelHostObject.h @@ -148,6 +148,8 @@ template class ModelHostObject : public JsiHostObject { } if constexpr (meta::SameAs) { + addFunctions( + JSI_EXPORT_FUNCTION(ModelHostObject, unload, "unload")); addFunctions(JSI_EXPORT_FUNCTION( ModelHostObject, synchronousHostFunction<&Model::interrupt>, "interrupt"));