fix(perry-ui-ios): finish #1107 — iOS 26 device rendering of Buttons + nested stack bg - #1127
Merged
Conversation
…+ nested stack bg PR #1109 shipped a partial fix for #1107 (partial-alpha NSColor renders zero glyphs on iOS 26 device) but three regressions / blind spots remained, all reproduced on physical iPhone running iOS 26.5: 1. Text widgets with `textSetColor(α < 1.0)` (e.g. Material's 87% black) still rendered nothing. #1109's `apply_label_color_via_attributed` reused the label's borrowed `view.font` pointer and the un-retained `initWithString:attributes:` result; the working AttributedText path builds a fresh `[UIFont systemFontOfSize:]` and retains the result. This commit mirrors that exact pattern. 2. Bare `Button("Mitmachen", cb)` + `widgetSetBackgroundColor(BRAND_RED)` rendered invisible. `buttonWithType:UIButtonTypeSystem` on iOS 26 routes through the Liquid Glass renderer, which overrides explicit `setTitleColor:` / `setBackgroundColor:` with the system tint. Switch to `UIButtonTypeCustom` (and seed `[UIColor labelColor]` as the default title color so a bare button with no explicit color is still visible). Also drop the `setAttributedTitle:nil` cleanup branch from #1109 — on iOS 26 it nukes the button's plain-title rendering along with the attributed state, leaving even α==1.0 buttons blank. 3. `widgetSetBackgroundColor` on a NESTED `UIStackView` painted transparent. `UIStackView.backgroundColor` is documented iOS 14+ but the property doesn't drive painting on inner stacks under iOS 26's compositor. The CALayer's own `backgroundColor` (CGColor) does paint reliably, so set both — view-level for non-buggy paths (root stack, iOS 17 sim) and layer-level as the belt-and-suspenders fix. Verified on iPhone running iOS 26.5: bisect of the Wishare Onboarding screen (TEXT_PRIMARY α=0.87 labels, BRAND_RED-bg `Mitmachen` button, white-bg nested card VStack) now renders all three widget classes. Follow-up issue #1122 tracks the broader audit of iOS 26 regressions.
Lint job on PR #1127 failed on `cargo fmt --check`. Single extraneous blank line between `set_background_color` and `gradient_bg_class`.
This was referenced May 19, 2026
Closed
proggeramlug
added a commit
that referenced
this pull request
May 21, 2026
…utton (#1284) PR #1127 added a CALayer.backgroundColor fallback for UIStackView to work around nested-stack transparency on iOS 26 device. UIButton has the same class of bug — Liquid Glass renderer can override setBackgroundColor: on certain button-type/configuration combinations even after #1127 forced UIButtonTypeCustom. Apply the same belt-and-suspenders fallback to UIButton so the CGColor lands on the layer directly regardless of UIKit-side interception. No behavior change for ordinary UIViews (setBackgroundColor: already updates layer.backgroundColor on those). Also rewrites the function's doc comment — it previously described an "inserting a UIView pinned to stack bounds" fallback that the actual implementation never did (we always set layer.backgroundColor with CGColor). Documents both currently-known iOS 26 cases (UIStackView, UIButton) and the rationale. Closes #1122 pending on-device retest. Native side has now layered #1109 (attributed-text for partial-alpha labels), #1127 (UIButtonTypeCustom + UIStackView layer fallback), and this PR (UIButton layer fallback). Underlying TS-compiler bug #1129 — which silently produced NaN/ undefined when the consumer app imported color object literals from another module, masking all native-side fixes — was closed by #1281 (baaeb44).
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Finishes the work started in #1109 for issue #1107 (partial-alpha NSColor renders zero glyphs on iOS 26 device). Three regressions / blind spots from #1109's first take remained, all reproduced on a physical iPhone running iOS 26.5:
textSetColor(α < 1.0)still painted nothing. fix(perry-ui-ios): #1107 partial-alpha text invisible on iOS 26 #1109 reused the label's borrowedview.fontpointer and the un-retainedinitWithString:attributes:result. The workingAttributedTextpath builds a fresh[UIFont systemFontOfSize:]from the label's current point size and retains the resultingNSAttributedString— this commit mirrors that exact pattern (apply_label_color_via_attributed).Button("x", cb)+widgetSetBackgroundColor(...)rendered invisible.buttonWithType:UIButtonTypeSystemon iOS 26 routes through the Liquid Glass renderer, which overrides explicitsetTitleColor:/setBackgroundColor:with the system tint. Switch toUIButtonTypeCustom, seed[UIColor labelColor]as the default title color so a bare button is still visible, and drop thesetAttributedTitle:nilcleanup branch from fix(perry-ui-ios): #1107 partial-alpha text invisible on iOS 26 #1109 (on iOS 26 it nukes the button's plain-title rendering along with the attributed state, leaving even α==1.0 buttons blank).widgetSetBackgroundColoron a NESTEDUIStackViewpainted transparent.UIStackView.backgroundColoris documented iOS 14+ but the property doesn't drive painting on inner stacks under iOS 26's compositor. The CALayer's ownbackgroundColor(CGColor) does paint reliably, so we set both — view-level for non-buggy paths (root stack, iOS 17 sim) and layer-level as the belt-and-suspenders fix.Related: #1122 (follow-up audit of remaining iOS 26 regressions).
Repro / verification
Bisect of the Wishare Onboarding screen on iPhone running iOS 26.5:
Text(slogan)with α=0.87 → invisible;Button("Mitmachen")with red bg → invisible; white-bg nested card VStack → transparent over outer pink screen.Note: a separate Perry TS-compiler issue affects cross-module imports of
{r,g,b,a}object literals — those still produce wrong values attextSetColor/widgetSetBackgroundColorcall sites even with this PR applied. I'm filing that as a separate issue; this PR only fixes the iOS 26 native-side rendering bugs.Test plan
Buttonwith no explicittextSetColorstill has visible text on light + dark mode (uses[UIColor labelColor]default)ButtonwithwidgetSetBackgroundColor(α=1.0)+textSetColor(WHITE α=1.0)paints red bg + white title on iOS 26 deviceTextwithtextSetColor(α=0.87)paints glyphs on iOS 26 deviceVStack+widgetSetBackgroundColor(WHITE α=1.0)paints over a colored parent on iOS 26 device