-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix skeletons interfering with attributed strings in text-based views (…
…#520) When enabling skeleton mode in a text-based view (`UILabel`, `UITextView`, `UITextField`), it sets the `textColor` to `.clear`, which is fine when `text` is used, but causes problems when `attributedText` is used, as it effectively "resets" the string to have a single color. Additionally, when a `UILabel` is nested inside a `UIStackView` a dummy string `" "` was set on the label's `text` so that it didn't have a 0 height content size. However, this workaround didn't consider the case where the label already had a non-empty text, meaning that this (intrusive) `text = " "` broke existing code by clearing the label's contents. By improving the corresponding `RecoverableXState` structs, we are able to preserve each element's contents and state as skeleton is disabled. Fixes #518. ## Changes - Create new `RecoverableLabelState` containing a `attributedText` and `text`, and use it on `UILabel`. - Update `RecoverableTextViewState` and `RecoverableTextFieldState` to have a `attributedText`. - Check if `UILabel`'s `text` is empty before setting dummy value when enabling skeleton mode in a label nested inside a `UIStackView`.
- Loading branch information
Showing
3 changed files
with
32 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters