material-components-ios
material-components-ios copied to clipboard
[TabBar] Invalid Item Size Height of View in MDCTabBarView()
For usage questions: ask on Stack Overflow.
A clear and concise description of what the bug is.
Actual behavior
MDCTabBarItem height is not rendered correctly which is causing vertical scrolling within TabBarView. The height of the item is more than the bounds of the tabbarview.
Platform (please complete the following information)
- Device: iPhone8
- OS: 14.1
Works fine in MDCTabBar. Please fix this.
Hi @Kedar-27, thanks for filing this issue. Can you provide some steps to reproduce? I'm not seeing this behavior in our examples.
Yes sure, actually i just used migration guide and the example for reference, the code was same and it caused the above error. Then i reverted back to Old MDCTabBar which is working perfectly as expected.
Hi @Kedar-27, what happens if you inspect the intrinsicContentSize
of the tab bar view when this bug is occurring? Is it bigger than the tab bar view's actual bounds? Are there height constraints on the tab bar view that are keeping it at an incorrect height?
Have the same issue. intrinsicContentSize of MDCTabBarView is (0.0, 48.0) right after instance creation. I'm using custom views for TabBarItem and intrinsicContentSize of these custom views is for example (60.0, 24.0), but custom views are stretched up to 48 pixels in height and vertical scroll bars appearing. I.e. even if MDCTabBarView has frame less than 48 pixels in height then tabs views are forced to 48 pixels and it looks like intrinsicContentSize of tabs views is ignored.
Reason: MDCTabBarView.m
/** Minimum (typical) height of a Material Tab bar. */ static const CGFloat kMinHeight = 48;
Solution: I have updated mentioned above constant to 24 and viola! It' works as expected for MDCTabBarView 24 pixels in height and greater.
@andrewoverton What is my next steps to complete above PR successfully? https://github.com/material-components/material-components-ios/pull/10206