Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The tableview cell does not show correct data after pressing Hide Skeleton #296

Closed
ldt25290 opened this issue Jun 3, 2020 · 7 comments · Fixed by #336
Closed

The tableview cell does not show correct data after pressing Hide Skeleton #296

ldt25290 opened this issue Jun 3, 2020 · 7 comments · Fixed by #336
Assignees

Comments

@ldt25290
Copy link

ldt25290 commented Jun 3, 2020

What did you expect to happen?

How to show correct data on tableview cell after hiding skeleton animation?

Steps to reproduce the behavior

Open library example project, modify cellForRowAt method as below button on screen:

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
    let cell = tableView.dequeueReusableCell(withIdentifier: "CellIdentifier", for: indexPath) as! Cell
    cell.label1.text = "cell => \(indexPath.row) date \(Date())" // add current date
    print("zzz \(String(describing: cell.label1.text))") // print current date
    return cell
}

The result is as below after pressing Hide Skeleton button:
Screen Shot 2020-06-03 at 14 27 07

As you can see, the date on the tableview cell does not show correctly on simulator. It shows different value from the value in the console at the bottom.

The date on the cell is 2020-06-03 07:26:35 +0000
The current date is 2020-06-03 07:26:59 +0000

SkeletonView Environment

SkeletonView version: 1.8.7
Xcode version: 11.5
Swift version: 5

@ldt25290 ldt25290 changed the title The tableview cell does not show correctly data after pressing Hide Skeleton The tableview cell does not show correct data after pressing Hide Skeleton Jun 4, 2020
@ivensdenner
Copy link

ivensdenner commented Jul 28, 2020

I'm facing the same problem!

I'm updating an UILabel's text and textColor property while isSkeletonActive == true. But when the skeleton is hidden, the data is replaced by the old values on recoverState method.

Is there some way to update the saved state of UILabel or something like that?

@jsahoo
Copy link

jsahoo commented Aug 11, 2020

+1 same issue. There's definitely a bug here that needs to be fixed but in the meantime a workaround is to hide the skeleton with no animation. It's a bit harsh (visually) but at least your labels will load properly:

hideSkeleton(transition: .none)

@mortenholmgaard
Copy link

mortenholmgaard commented Aug 24, 2020

Same case with view outside tables:
emailLabel.showAnimatedSkeleton()
async handling
emailLabel.text = "[email protected]"
emailLabel.hideSkeleton(transition: .crossDissolve(0.25))
emailLabel shows text from before emailLabel.showAnimatedSkeleton()

v. 1.8.7
@Juanpe please have a look at this.

@Juanpe
Copy link
Owner

Juanpe commented Sep 8, 2020

Hi guys, I'm going to investigate. Let's you know when I've more info about that

@Juanpe Juanpe self-assigned this Sep 8, 2020
@Juanpe
Copy link
Owner

Juanpe commented Sep 9, 2020

Same case with view outside tables:
emailLabel.showAnimatedSkeleton()
async handling
emailLabel.text = "[email protected]"
emailLabel.hideSkeleton(transition: .crossDissolve(0.25))
emailLabel shows text from before emailLabel.showAnimatedSkeleton()

v. 1.8.7
@Juanpe please have a look at this.

I'm reviewing that, but you can swap the execution of the methods. I mean, your code would look like that:

emailLabel.hideSkeleton() // Default transition is crossDissolve(0.25)
emailLabel.text = "[email protected]"

@t643961
Copy link

t643961 commented Sep 24, 2020

hi all, do wen have any update on this issue? It is still not working for me.

@Juanpe
Copy link
Owner

Juanpe commented Oct 2, 2020

Hi all, the next version will fix this problem.

If you want to check if the problem is solved with this fix you can set the dependency in your podfile, pointing to the develop branch.

Podfile
pod 'SkeletonView', :git => 'https://github.com/Juanpe/SkeletonView.git', :branch => 'develop'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants