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