evgenyneu / Cosmos

A star rating control for iOS/tvOS written in Swift
MIT License
2.18k stars 366 forks source link

Filled color values changing even though the data is not. #185

Closed willcunane closed 3 years ago

willcunane commented 3 years ago

When selecting an item via table view selection, sometimes the filledColor value will change even though the data being used to create the values will not change (you can see it being printed to the console in the video).

Library setup method: CocoaPods Version of the library: 23.0 12.3 iOS 13.0

https://user-images.githubusercontent.com/25822037/122808204-92863e80-d29a-11eb-9117-904c3d3864d8.mov

evgenyneu commented 3 years ago

Hi @willcunane sorry don't understand the problem. Could you please explain a little more?

willcunane commented 3 years ago

In the video I select a row from my tableview and sometimes (not every time) the stars in the row selected change the value of active stars. So the Phillips 66 should be 2 stars, in the video after the 2nd click, you can see that the stars go from 2 filled in stars to 5. In the console to the left I have it printing the value of what the stars should be.

The bug could very well be on my end but I tried to troubleshoot for a few hours and couldn't seem to find the issue.

iTollMouS commented 3 years ago

I’m pretty sure the issue is the passing data .

On Jun 22, 2021, at 12:14 AM, Will Cunane @.***> wrote:



In the video I select a row from my tableview and sometimes (not every time) the stars in the row selected change the value of active stars. So the Phillips 66 should be 2 stars, in the video after the 2nd click, you can see that the stars go from 2 filled in stars to 5. In the console to the left I have it printing the value of what the stars should be.

The bug could very well be on my end but I tried to troubleshoot for a few hours and couldn't seem to find the issue.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/evgenyneu/Cosmos/issues/185#issuecomment-865348683, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AHXPK5O3PLBV3D7UKMWFOQDTT6TUXANCNFSM47CCUD3Q.

willcunane commented 3 years ago

Ok thanks, I'll check it out again tonight and close the issue if I get it figured out

willcunane commented 3 years ago

After testing it multiple times the issue still persists but only on a simulator. When I run it on my device it works with no problems. I'll just leave my code below for reference on how I'm passing the data to Cosmos.

cell.cosmosLabel.rating = Double(data.rating) ?? 0

evgenyneu commented 3 years ago

Thanks for clarifying @willcunane

So the Phillips 66 should be 2 stars, in the video after the 2nd click, you can see that the stars go from 2 filled in stars to 5.

Phillips 66 changed to five stars because you clicked on it (at 4 sec in the video). You can disable user interactions by

cosmosView.settings.updateOnTouch = false

as documented here under "Touch Settings". Let me know if it helps.