[Android] Cannot hide inner contents when parent <View> has height or width of 0
See original GitHub issueI’m trying to use LayoutAnimation as a a means of hiding and showing different View elements. If I set height: 0
and overflow: 'hidden'
, the View’s contents are completely hidden in iOS. The ideas being that using LayoutAnimation, I’ll toggle the height property to make the View elements slide up and down.
On Android though, that’s the not the case. From what I’ve observed, the View will only shrink as small as the inner contents. It won’t clip the inner elements.
I’ve removed the LayoutAnimation piece from my sample code. You can see what I’m talking about here https://rnplay.org/apps/yO0W4Q. The “ViewTwo” text is still visible even though the parent View has a height: 0, flex: 0, overflow: 'hidden'
. If you run the demo in iOS, it works as designed. Is there a way around this or is this a bug or limitation on Android? Any suggestions on how to work around it? Thanks!
Issue Analytics
- State:
- Created 7 years ago
- Reactions:2
- Comments:7 (2 by maintainers)
A temporary workaround that sometimes works, but not always, is setting the height/width of the view you want to hide to 0.1 instead of 0. For some reason this will hide the contained view when 0 won’t.
The problem is the bot is pasting the mail body where mkonicek is split in two lines like this
Which then tags me in a lot of PRs suddenly. Anyway I put your bot on ignore now maybe that helps