| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 6dba52f commit 93dd5f6
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -11,18 +11,13 @@ export class LayoutBase extends LayoutBaseCommon { | |||
| 11 | 11 | return true; | |
| 12 | 12 | } | |
| 13 | 13 | [clipToBoundsProperty.setNative](value: boolean) { | |
| 14 | - // TODO: Use ClipRectangle if API > 16! | ||
| 15 | - | ||
| 16 | - // We can't implement this without calling setClipChildren(false) on every ancestor up in the visual tree, | ||
| 17 | - // which will kill performance. It will also lead to unwanted side effects such as other totally unrelated | ||
| 18 | - // views being affected by setting the parents' setClipChildren to false. | ||
| 19 | - // The problem in Android is that a ViewGroup either clips ALL of its children or it does not. Unlike iOS, the clipping | ||
| 20 | - // cannot be controlled on a per view basis. So clipToBounds=false will have to be somehow achieved with stacking different | ||
| 21 | - // views on top of one another in an AbsoluteLayout or GridLayout. There is always a workaround when playing with layouts. | ||
| 22 | - // | ||
| 23 | - // The following article explains this in detail: | ||
| 24 | - // http://stackoverflow.com/questions/25044085/when-drawing-outside-the-view-clip-bounds-with-android-how-do-i-prevent-underli | ||
| 25 | - console.warn(`clipToBounds with value false is not supported on Android. You can use this.android.getParent().setClipChildren(false) as an alternative`); | ||
| 14 | + // Android clips per parent, not per child: a ViewGroup either confines | ||
| 15 | + // every child to its own bounds or none of them. A view that must draw | ||
| 16 | + // outside itself (a box-shadow, a translated child) therefore needs its | ||
| 17 | + // parent layout's clipToBounds set to false, not its own. | ||
| 18 | + const nativeView = this.nativeViewProtected; | ||
| 19 | + nativeView.setClipChildren(value); | ||
| 20 | + nativeView.setClipToPadding(value); | ||
| 26 | 21 | } | |
| 27 | 22 | ||
| 28 | 23 | [isPassThroughParentEnabledProperty.setNative](value: boolean) { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments