From c42c3c5f2609afaa96bf874c427f0702f8cd5daa Mon Sep 17 00:00:00 2001 From: Nathan Walker Date: Mon, 23 Jan 2023 12:08:00 -0800 Subject: [PATCH] fix(ios): race conditions with nativeView (#10182) --- packages/core/ui/styling/background.ios.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/packages/core/ui/styling/background.ios.ts b/packages/core/ui/styling/background.ios.ts index 6e8f8f320..c08121839 100644 --- a/packages/core/ui/styling/background.ios.ts +++ b/packages/core/ui/styling/background.ios.ts @@ -193,11 +193,13 @@ function setUIColorFromImage(view: View, nativeView: UIView, callback: (uiColor: bitmap = imageSource && imageSource.ios; } else if (imageUri.indexOf('http') !== -1) { style[symbolUrl] = imageUri; - ImageSource.fromUrl(imageUri).then((r) => { - if (style && style[symbolUrl] === imageUri) { - uiColorFromImage(r.ios, view, callback, flip); - } - }); + ImageSource.fromUrl(imageUri) + .then((r) => { + if (style && style[symbolUrl] === imageUri) { + uiColorFromImage(r.ios, view, callback, flip); + } + }) + .catch(() => {}); } uiColorFromImage(bitmap, view, callback, flip); @@ -360,7 +362,7 @@ function getDrawParams(this: void, image: UIImage, background: BackgroundDefinit function uiColorFromImage(img: UIImage, view: View, callback: (uiColor: UIColor) => void, flip?: boolean): void { const background = view.style.backgroundInternal; - if (!img) { + if (!img || !view.nativeViewProtected) { callback(background.color && background.color.ios); return;