fix: backport iOS invalid element type crash fix
This commit is contained in:
parent
eb6b9bf607
commit
afacfa0648
1 changed files with 6 additions and 0 deletions
|
|
@ -23,6 +23,12 @@ export function deleteJsxCreate(Component: string, callback: Callback) {
|
||||||
*/
|
*/
|
||||||
export function patchJsx() {
|
export function patchJsx() {
|
||||||
const callback = ([Component]: unknown[], ret: JSX.Element) => {
|
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
|
// The check could be more complex, but this is fine for now to avoid overhead
|
||||||
if (typeof Component === "function" && callbacks.has(Component.name)) {
|
if (typeof Component === "function" && callbacks.has(Component.name)) {
|
||||||
const cbs = callbacks.get(Component.name)!;
|
const cbs = callbacks.get(Component.name)!;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue