Skip to content

Using clip-path or border-radius doesn't clip children on Android #8158

@darkyelox

Description

@darkyelox

Environment

  • CLI: 6.1.2
  • Cross-platform modules: 6.1.2
  • Android Runtime: 6.0.2 or 6.1.2 (using 6.0.2 because of performance problems)
  • Plugin(s):
    "dependencies": {
    "@angular/animations": "~8.2.0",
    "@angular/common": "~8.2.0",
    "@angular/compiler": "~8.2.0",
    "@angular/core": "~8.2.0",
    "@angular/forms": "~8.2.0",
    "@angular/http": "~8.0.0-beta.10",
    "@angular/platform-browser": "~8.2.0",
    "@angular/platform-browser-dynamic": "~8.2.0",
    "@angular/router": "~8.2.0",
    "@nstudio/nativescript-checkbox": "^1.0.0",
    "animejs": "^3.1.0",
    "base-64": "^0.1.0",
    "class-transformer": "^0.2.3",
    "clone-deep": "^4.0.1",
    "lodash.isnil": "^4.0.0",
    "lodash.orderby": "^4.6.0",
    "lodash.shuffle": "^4.2.0",
    "lodash.values": "^4.3.0",
    "moment": "^2.24.0",
    "nativescript-advanced-webview": "^4.0.1",
    "nativescript-angular": "^8.2.1",
    "nativescript-canvas": "^2.1.5",
    "nativescript-datetimepicker": "^1.2.1",
    "nativescript-drop-down": "^5.0.0",
    "nativescript-feedback": "^1.3.9",
    "nativescript-http-formdata": "^1.7.0",
    "nativescript-imagecropper": "^1.0.7",
    "nativescript-intl": "^3.0.0",
    "nativescript-iqkeyboardmanager": "^1.5.1",
    "nativescript-localize": "^4.1.1",
    "nativescript-material-bottomsheet": "^2.5.0",
    "nativescript-mediafilepicker": "^2.0.17",
    "nativescript-pager": "^11.0.9",
    "nativescript-permissions": "^1.3.7",
    "nativescript-phone": "^1.4.0",
    "nativescript-platform-css": "^1.6.9",
    "nativescript-plugin-firebase": "^10.0.0",
    "nativescript-sqlite": "^2.3.3",
    "nativescript-theme-core": "^1.0.4",
    "nativescript-ui-calendar": "^5.0.0",
    "nativescript-ui-listview": "^7.0.4",
    "nativescript-ui-sidedrawer": "^7.0.2",
    "ngx-custom-validators": "^7.0.0",
    "ngx-moment": "^3.4.0",
    "reflect-metadata": "~0.1.12",
    "rxjs": "^6.4.0",
    "tns-core-modules": "^6.1.2",
    "typeorm": "^0.2.18",
    "zone.js": "^0.9.1"
    },
    "devDependencies": {
    "@angular/compiler-cli": "~8.2.0",
    "@ngtools/webpack": "~8.2.0",
    "@types/mocha": "^5.2.7",
    "@types/node": "^12.0.7",
    "nativescript-dev-webpack": "~1.2.0",
    "node-sass": "4.12.0",
    "tns-platform-declarations": "^6.1.1",
    "ts-loader": "^6.1.2",
    "typescript": "~3.5.3"
    },

Describe the bug
Using clip-path or border-radius in Android makes the children elements to overflow outside of their parent component and looks like having a z-index higher than parent, so in my example i'm trying to create a Star rating component that shows a golden background for stars checked (yes i can only change the background of the star but i want also to apply half filled stars and so on or for do many other things):

image

So i have an StackLayout that represents the star using a clip-path, and inside of it other StackLayout that represents the star filled, i show or hide the background depending of interaction of the user, in iOS works great but in Android doesn't, for now the only solution is to apply the same clip-path to the background.

To Reproduce
Simply create a StackLayout with other inside, to the outer layout apply a clip-path, for example you can use one from clippy and set a background color to the inside layout.

example style:

.star {
    width: 60;
    height: 60;
    margin: 5;
    border-width: 2;
    border-color: gray;
    background-color: lightgray;
    clip-path: polygon(50% 0%, 64% 32%, 98% 35%, 72% 56%, 79% 91%, 50% 70%, 21% 91%, 29% 56%, 2% 35%, 37% 32%);
}

.star-fill{
    width: 60;
    height: 60;
    background-color: gold;
}
<StackLayout star class="star">
	<StackLayout class="star-fill">
	</StackLayout>
</StackLayout>

Expected behavior
The same behavior of iOS with the posibility of disable or enable the overflow at any time using maybe clipToBounds option (clipToBounds = true for default to don't let children to overflow)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions