Skip to content

Skeleton displays in device's selected theme for fraction of second #392

Description

@KrishnaKaira

Description

We have custom implementation of dark theme, and user can select theme from inside the application setting. Now, when user either uses system theme, or same theme as device, skeleton color shows smoothly. But lets say if user selects 'Dark' theme in application setting, and user's device is in 'Light' mode, the skeleton displays in light mode for a fraction of second before it switches to dark color, and vice versa.
Seems like some how skeleton is picking device's theme before it switches to application's theme. We are overriding the theme using
overrideUserInterfaceStyle = style //.dark, .light OR .unspecified
in viewDidLoad() before adding skeleton to the view.

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

  • bug
  • enhancement (feature request)
  • question
  • documentation related
  • discussion

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

  • I've read and understood the Contributing guidelines and have done my best effort to follow them.
  • I've read and agree to the Code of Conduct.
  • I've searched for any related issues and avoided creating a duplicate issue.

Bug Report

We are overriding the UIViewController's property inside viewDidLoad based on user's preference from inside app setting:
overrideUserInterfaceStyle = style //.dark, .light OR .unspecified
Now, added skeleton view as subview and setting the color for skeleton as:
view.showAnimatedGradientSkeleton(usingGradient: SkeletonGradient(baseColor: UIColor.appColor(.gray6)))

UIColor.appColor(.gray6) -> returns adaptive color equals to UIColor.systemGray6

We have tried to set fix color also, but still it shows in device's theme first before setting the color properly.

SkeletonView Environment:

SkeletonView version: 1.8.6
Xcode version: 12.4
Swift version: 4.x

Steps to reproduce:

Please replace this with the steps to reproduce the behavior.

  1. Add this to viewDidLoad: overrideUserInterfaceStyle = .dark
  2. Now add skeleton view as subview on viewController's view
  3. keep your device in light mode (disable dark mode)
  4. show Skeleton using view.showAnimatedGradientSkeleton(usingGradient: SkeletonGradient(baseColor: UIColor.systemGray6))

Expected result:

Skeletons color should always show in provided color.

Actual result:

Skeleton color was displaying in device's theme for fraction of second before displaying the accurate color.

Attachments:

SkeletonView_bug.mp4

Activity

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

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions