From 9d87e7ffbb9f6af67c245946570b53bc1ced8ed3 Mon Sep 17 00:00:00 2001 From: Nathan Walker Date: Sun, 9 Aug 2026 00:07:11 -0700 Subject: [PATCH] fix(ffi): make native class instanceof checks marshal the real Class Symbol.hasInstance passed the raw constructable to isKindOfClass(), but only the proxied wrapper resolves __nativeApiClass, so the argument did not marshal to the Objective-C Class and isKindOfClass() misreported membership (a UIView tested true for instanceof UIViewController). @nativescript/core gates child-view-controller mounting on exactly that check, so pages passed a UIView to addChildViewController and UIKit crashed on parentViewController. Pass the wrapper and require a strict true result. Co-Authored-By: Claude Fable 5 --- NativeScript/ffi/shared/jsi/NativeApiJsiInstall.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/NativeScript/ffi/shared/jsi/NativeApiJsiInstall.h b/NativeScript/ffi/shared/jsi/NativeApiJsiInstall.h index 6e711d5be..370497eee 100644 --- a/NativeScript/ffi/shared/jsi/NativeApiJsiInstall.h +++ b/NativeScript/ffi/shared/jsi/NativeApiJsiInstall.h @@ -930,8 +930,11 @@ void InstallNativeApiJsiGlobalSymbols(Runtime& runtime, const char* globalName) } var expectedName = nativeClass.runtimeName || nativeClass.name; try { + // Pass the proxied wrapper: the raw constructable carries no + // __nativeApiClass, so it does not marshal to the Objective-C + // Class and isKindOfClass() misreports. if (typeof value.isKindOfClass === 'function' && - value.isKindOfClass(constructable)) { + value.isKindOfClass(wrapper || constructable) === true) { return true; } } catch (_) {