Juanpe / SkeletonView

☠️ An elegant way to show users that something is happening and also prepare them to which contents they are awaiting
MIT License
12.51k stars 1.1k forks source link

automaticDimension is ignored, only estimatedRowHeight is used as Height #468

Closed peterpaulis closed 2 years ago

peterpaulis commented 2 years ago

Description

The height of the skeleton cell should be calculated using autolayout based upon it's content, but the cell has always the height from estimatedRowHeight, no matter when providing delegate or rowHeight == UITableView.automaticDimension

What type of issue is this? (place an x in one of the [ ])

Requirements (place an x in each of the [ ])


Bug Report

Filling out the following details about bugs will help us solve your issue sooner.

SkeletonView Environment:

SkeletonView version:1.26.0 Xcode version:13.1 (13A1030d) Swift version:5

Steps to reproduce:

The height of the skeleton cell should be calculated using autolayout based upon it's content, but the cell has always the height from estimatedRowHeight, no matter when providing delegate or rowHeight == UITableView.automaticDimension

the docu only states

1️⃣ If you are using resizable cells (tableView.rowHeight = UITableViewAutomaticDimension), it's mandatory define the estimatedRowHeight.

but not, that the an exact size is the only option and you are left out of automaticDimension :( so i suppose this is a bug?

Expected result:

height of the sekelton cell should be based upon UITableView.automaticDimension not estimatedRowHeight

Actual result:

estimatedRowHeight is always used, no matter the content

Juanpe commented 2 years ago

Hi @peterpaulis 👋🏼

Yep, you're right. Now, SkeletonView neither calculates the height of the cells nor considers the value provided by the delegate.

There is an open PR to allow to specify the height for each cell. #460

peterpaulis commented 2 years ago

i believe this to be a very important feature... as you can display the table with different kinds of cells, have the skeleton cell match the content (like when you have a text size setting) or have random skeleton content (which changes the height)... looking forward for this to be added to main

as i understand the problem may be in calculating the number of desired cells to fill the table... in this context it would be ok i believe for the programmer to provide a really large number of rows (e.g. 999) as the cell reuse is very effective and only the displayed cells are handled... so basically it has no impact if there are 7 visible cells and 992 not visible, or just 7 visible

Juanpe commented 2 years ago

Duplicate of #424

Juanpe commented 2 years ago

I'm going to close this issue because it's duplicated with #424

Thanks