fix(ios): race conditions with nativeView (#10182)

This commit is contained in:
Nathan Walker
2023-01-23 12:08:00 -08:00
committed by GitHub
parent 9f76fea06e
commit c42c3c5f26

View File

@ -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;