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

[TabBar] Invalid Item Size Height of View in MDCTabBarView()

Open Kedar-27 opened this issue 3 years ago • 6 comments

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

Kedar-27 avatar Nov 10 '20 17:11 Kedar-27

Works fine in MDCTabBar. Please fix this.

Kedar-27 avatar Nov 10 '20 17:11 Kedar-27

Hi @Kedar-27, thanks for filing this issue. Can you provide some steps to reproduce? I'm not seeing this behavior in our examples.

andrewoverton avatar Nov 16 '20 18:11 andrewoverton

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.

Kedar-27 avatar Nov 17 '20 06:11 Kedar-27

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?

andrewoverton avatar Dec 30 '20 18:12 andrewoverton

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.

andrew-nemtsev avatar May 21 '21 13:05 andrew-nemtsev

@andrewoverton What is my next steps to complete above PR successfully? https://github.com/material-components/material-components-ios/pull/10206

andrew-nemtsev avatar May 24 '21 08:05 andrew-nemtsev