mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-03 03:30:04 +08:00
fix(ios): resilience to nativeView access under edge cases (#10276)
This commit is contained in:
@ -898,13 +898,15 @@ export class View extends ViewCommon implements ViewDefinition {
|
||||
CATransaction.begin();
|
||||
}
|
||||
|
||||
if (value instanceof UIColor) {
|
||||
this.nativeViewProtected.backgroundColor = value;
|
||||
} else {
|
||||
iosBackground.createBackgroundUIColor(this, (color: UIColor) => {
|
||||
this.nativeViewProtected.backgroundColor = color;
|
||||
});
|
||||
this._setNativeClipToBounds();
|
||||
if (this.nativeViewProtected) {
|
||||
if (value instanceof UIColor) {
|
||||
this.nativeViewProtected.backgroundColor = value;
|
||||
} else {
|
||||
iosBackground.createBackgroundUIColor(this, (color: UIColor) => {
|
||||
this.nativeViewProtected.backgroundColor = color;
|
||||
});
|
||||
this._setNativeClipToBounds();
|
||||
}
|
||||
}
|
||||
|
||||
if (!updateSuspended) {
|
||||
@ -915,8 +917,10 @@ export class View extends ViewCommon implements ViewDefinition {
|
||||
}
|
||||
|
||||
_setNativeClipToBounds() {
|
||||
const backgroundInternal = this.style.backgroundInternal;
|
||||
this.nativeViewProtected.clipsToBounds = (this.nativeViewProtected instanceof UIScrollView || backgroundInternal.hasBorderWidth() || backgroundInternal.hasBorderRadius()) && !backgroundInternal.hasBoxShadow();
|
||||
if (this.nativeViewProtected) {
|
||||
const backgroundInternal = this.style.backgroundInternal;
|
||||
this.nativeViewProtected.clipsToBounds = (this.nativeViewProtected instanceof UIScrollView || backgroundInternal.hasBorderWidth() || backgroundInternal.hasBorderRadius()) && !backgroundInternal.hasBoxShadow();
|
||||
}
|
||||
}
|
||||
|
||||
private _setupPopoverControllerDelegate(controller: UIViewController, parent: View) {
|
||||
|
||||
@ -23,7 +23,9 @@ export class LayoutBase extends LayoutBaseCommon {
|
||||
|
||||
_setNativeClipToBounds() {
|
||||
if (this.clipToBounds) {
|
||||
this.nativeViewProtected.clipsToBounds = true;
|
||||
if (this.nativeViewProtected) {
|
||||
this.nativeViewProtected.clipsToBounds = true;
|
||||
}
|
||||
} else {
|
||||
super._setNativeClipToBounds();
|
||||
}
|
||||
|
||||
@ -275,7 +275,9 @@ export class ListView extends ListViewBase {
|
||||
|
||||
_setNativeClipToBounds() {
|
||||
// Always set clipsToBounds for list-view
|
||||
this.ios.clipsToBounds = true;
|
||||
if (this.ios) {
|
||||
this.ios.clipsToBounds = true;
|
||||
}
|
||||
}
|
||||
|
||||
@profile
|
||||
|
||||
Reference in New Issue
Block a user