mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 03:31:45 +08:00
fix(ios): race conditions with nativeView (#10182)
This commit is contained in:
@ -193,11 +193,13 @@ function setUIColorFromImage(view: View, nativeView: UIView, callback: (uiColor:
|
|||||||
bitmap = imageSource && imageSource.ios;
|
bitmap = imageSource && imageSource.ios;
|
||||||
} else if (imageUri.indexOf('http') !== -1) {
|
} else if (imageUri.indexOf('http') !== -1) {
|
||||||
style[symbolUrl] = imageUri;
|
style[symbolUrl] = imageUri;
|
||||||
ImageSource.fromUrl(imageUri).then((r) => {
|
ImageSource.fromUrl(imageUri)
|
||||||
|
.then((r) => {
|
||||||
if (style && style[symbolUrl] === imageUri) {
|
if (style && style[symbolUrl] === imageUri) {
|
||||||
uiColorFromImage(r.ios, view, callback, flip);
|
uiColorFromImage(r.ios, view, callback, flip);
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
|
.catch(() => {});
|
||||||
}
|
}
|
||||||
|
|
||||||
uiColorFromImage(bitmap, view, callback, flip);
|
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 {
|
function uiColorFromImage(img: UIImage, view: View, callback: (uiColor: UIColor) => void, flip?: boolean): void {
|
||||||
const background = view.style.backgroundInternal;
|
const background = view.style.backgroundInternal;
|
||||||
|
|
||||||
if (!img) {
|
if (!img || !view.nativeViewProtected) {
|
||||||
callback(background.color && background.color.ios);
|
callback(background.color && background.color.ios);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
Reference in New Issue
Block a user