Content-Length: 379336 | pFad | http://github.com/NativeScript/NativeScript/commit/ee87b52ac323e220b7b154d27a55cbf4cdbd59c4

1D fix(ios): add/remove shadow for reusable views (#10409) · NativeScript/NativeScript@ee87b52 · GitHub
Skip to content

Commit ee87b52

Browse files
authored
fix(ios): add/remove shadow for reusable views (#10409)
1 parent c23695c commit ee87b52

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

Diff for: packages/core/ui/core/view/index.ios.ts

+15-12
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { Trace } from '../../../trace';
88
import { layout, iOSNativeHelper } from '../../../utils';
99
import { isNumber } from '../../../utils/types';
1010
import { IOSHelper } from './view-helper';
11-
import { ios as iosBackground, Background, BackgroundClearFlags } from '../../styling/background';
11+
import { ios as iosBackground, Background } from '../../styling/background';
1212
import { perspectiveProperty, visibilityProperty, opacityProperty, rotateProperty, rotateXProperty, rotateYProperty, scaleXProperty, scaleYProperty, translateXProperty, translateYProperty, zIndexProperty, backgroundInternalProperty } from '../../styling/style-properties';
1313
import { profile } from '../../../profiling';
1414
import { accessibilityEnabledProperty, accessibilityHiddenProperty, accessibilityHintProperty, accessibilityIdentifierProperty, accessibilityLabelProperty, accessibilityLanguageProperty, accessibilityLiveRegionProperty, accessibilityMediaSessionProperty, accessibilityRoleProperty, accessibilityStateProperty, accessibilityValueProperty, accessibilityIgnoresInvertColorsProperty } from '../../../accessibility/accessibility-properties';
@@ -73,15 +73,6 @@ export class View extends ViewCommon implements ViewDefinition {
7373
this._isLaidOut = false;
7474
this._hasTransform = false;
7575
this._hasPendingTransform = false;
76-
77-
// If native view extends UIView, perform a background cleanup to get rid of shadow layers
78-
if (this.nativeViewProtected instanceof UIView) {
79-
// Make sure shadows get removed
80-
this.style.backgroundInternal.clearFlags |= BackgroundClearFlags.CLEAR_BOX_SHADOW;
81-
82-
// Perform background cleanup
83-
iosBackground.clearBackgroundVisualEffects(this);
84-
}
8576
}
8677

8778
public requestLayout(): void {
@@ -1096,7 +1087,7 @@ export class CustomLayoutView extends ContainerView {
10961087
super._addViewToNativeVisualTree(child, atIndex);
10971088

10981089
const parentNativeView = this.nativeViewProtected;
1099-
const childNativeView = child.nativeViewProtected;
1090+
const childNativeView: NativeScriptUIView = <NativeScriptUIView>child.nativeViewProtected;
11001091

11011092
if (parentNativeView && childNativeView) {
11021093
if (typeof atIndex !== 'number' || atIndex >= parentNativeView.subviews.count) {
@@ -1105,6 +1096,11 @@ export class CustomLayoutView extends ContainerView {
11051096
parentNativeView.insertSubviewAtIndex(childNativeView, atIndex);
11061097
}
11071098

1099+
// Add outer shadow layer manually as it belongs to parent layer tree (this is needed for reusable views)
1100+
if (childNativeView.outerShadowContainerLayer && !childNativeView.outerShadowContainerLayer.superlayer) {
1101+
parentNativeView.layer.insertSublayerBelow(childNativeView.outerShadowContainerLayer, childNativeView.layer);
1102+
}
1103+
11081104
return true;
11091105
}
11101106

@@ -1115,7 +1111,14 @@ export class CustomLayoutView extends ContainerView {
11151111
super._removeViewFromNativeVisualTree(child);
11161112

11171113
if (child.nativeViewProtected) {
1118-
child.nativeViewProtected.removeFromSuperview();
1114+
const nativeView: NativeScriptUIView = <NativeScriptUIView>child.nativeViewProtected;
1115+
1116+
// Remove outer shadow layer manually as it belongs to parent layer tree
1117+
if (nativeView.outerShadowContainerLayer) {
1118+
nativeView.outerShadowContainerLayer.removeFromSuperlayer();
1119+
}
1120+
1121+
nativeView.removeFromSuperview();
11191122
}
11201123
}
11211124
}

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/NativeScript/NativeScript/commit/ee87b52ac323e220b7b154d27a55cbf4cdbd59c4

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy