material-components-ios icon indicating copy to clipboard operation
material-components-ios copied to clipboard

[Card] Unable to use clipToBound on MDCCard without lose effects

Open baillyjamy opened this issue 4 years ago • 2 comments

Actual behavior

Hello, I have a label that I use as a header in an MDCCard. So it's attached to the top of my view and I applied a color to it in the background. I applied a rounding on the corners of 20. The label protrudes from my MDCCard on the corners. So I apply a clipToBound on my view but it breaks the shadow and the elevation of the card. I read somewhere that I had to make a child uiview in the map and apply the clipToBound to the child. This method works but it breaks the ripple when you touch the view. I also have to apply this clipToBound on MDCCards that have a tableview inside and this is a problem because I lose shadow and elevation there as well.

Reproduction steps

Steps to reproduce the behavior:

Just apply clipToBound on a MDCCard

Expected behavior

Be able to use clipToBound or maskToBound on MDCCard and MDCCardCollectionCell without losing their functionality and effect.

Platform (please complete the following information)

  • Device: All
  • OS: 13
  • MaterialComponents: 119.3.0

baillyjamy avatar Dec 21 '20 14:12 baillyjamy

The title doesn't have a [Component] prefix.

Same problem with clipToBound.I find a possible solution from a Chinese guy blog says "you should add a SubLayer and then add shadow" but I don't know how to do with that.Maybe this won't be a good idea.Another problem is ,when using MDCCardCollectionCell on storyboard it will lose shadow and elevation as well.So is there anyone can help us?

GaoShin avatar Dec 23 '20 06:12 GaoShin