@@ -8,7 +8,7 @@ import { Trace } from '../../../trace';
8
8
import { layout , iOSNativeHelper } from '../../../utils' ;
9
9
import { isNumber } from '../../../utils/types' ;
10
10
import { IOSHelper } from './view-helper' ;
11
- import { ios as iosBackground , Background , BackgroundClearFlags } from '../../styling/background' ;
11
+ import { ios as iosBackground , Background } from '../../styling/background' ;
12
12
import { perspectiveProperty , visibilityProperty , opacityProperty , rotateProperty , rotateXProperty , rotateYProperty , scaleXProperty , scaleYProperty , translateXProperty , translateYProperty , zIndexProperty , backgroundInternalProperty } from '../../styling/style-properties' ;
13
13
import { profile } from '../../../profiling' ;
14
14
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 {
73
73
this . _isLaidOut = false ;
74
74
this . _hasTransform = false ;
75
75
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
- }
85
76
}
86
77
87
78
public requestLayout ( ) : void {
@@ -1096,7 +1087,7 @@ export class CustomLayoutView extends ContainerView {
1096
1087
super . _addViewToNativeVisualTree ( child , atIndex ) ;
1097
1088
1098
1089
const parentNativeView = this . nativeViewProtected ;
1099
- const childNativeView = child . nativeViewProtected ;
1090
+ const childNativeView : NativeScriptUIView = < NativeScriptUIView > child . nativeViewProtected ;
1100
1091
1101
1092
if ( parentNativeView && childNativeView ) {
1102
1093
if ( typeof atIndex !== 'number' || atIndex >= parentNativeView . subviews . count ) {
@@ -1105,6 +1096,11 @@ export class CustomLayoutView extends ContainerView {
1105
1096
parentNativeView . insertSubviewAtIndex ( childNativeView , atIndex ) ;
1106
1097
}
1107
1098
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
+
1108
1104
return true ;
1109
1105
}
1110
1106
@@ -1115,7 +1111,14 @@ export class CustomLayoutView extends ContainerView {
1115
1111
super . _removeViewFromNativeVisualTree ( child ) ;
1116
1112
1117
1113
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 ( ) ;
1119
1122
}
1120
1123
}
1121
1124
}
0 commit comments