Skip to content

Commit

Permalink
fix: backport iOS invalid element type crash fix
Browse files Browse the repository at this point in the history
  • Loading branch information
PalmDevs committed Dec 5, 2024
1 parent eb6b9bf commit afacfa0
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/lib/api/react/jsx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)!;
Expand Down

0 comments on commit afacfa0

Please sign in to comment.