From afacfa06480f60d461840a211c09abb363dc8546 Mon Sep 17 00:00:00 2001 From: PalmDevs Date: Thu, 5 Dec 2024 19:15:52 +0700 Subject: [PATCH] fix: backport iOS invalid element type crash fix --- src/lib/api/react/jsx.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/lib/api/react/jsx.ts b/src/lib/api/react/jsx.ts index 571eebc3..b3d025b7 100644 --- a/src/lib/api/react/jsx.ts +++ b/src/lib/api/react/jsx.ts @@ -23,6 +23,12 @@ export function deleteJsxCreate(Component: string, callback: Callback) { */ export function patchJsx() { const callback = ([Component]: unknown[], ret: JSX.Element) => { + // Band-aid fix for iOS invalid element type crashes + if (typeof ret.type === 'undefined') { + ret.type = 'RCTView' + return ret + } + // The check could be more complex, but this is fine for now to avoid overhead if (typeof Component === "function" && callbacks.has(Component.name)) { const cbs = callbacks.get(Component.name)!;