Skip to content

feat(ios): support buttonColor on the modal - #979

Open
loikfb wants to merge 1 commit into
henninghall:masterfrom
loikfb:feat/ios-button-color
Open

loikfb wants to merge 1 commit into
henninghall:masterfrom
loikfb:feat/ios-button-color

Conversation

@loikfb

@loikfb loikfb commented Oct 28, 2026

Copy link
Copy Markdown

buttonColor only applied to the Android modal. On iOS the sheet's buttons were always the system blue, which clashes with apps that use their own tint.

  • iOS: when buttonColor is set, the modal's alert controller uses it as its tint (Confirm and Cancel).
  • The black/white default derived from theme now applies only on Android. iOS gets buttonColor only when the app passes one, so existing iOS users see no change.
  • iOS 26 fills the preferred (Confirm) action with the tint under a white label, which is unreadable on light colors. For a light buttonColor the label turns black (UIAlertAction's titleTextColor key, guarded by @try).
  • README and typings: no longer Android-only.

Tested on iOS 26 and iOS 18 (light and dark, with and without buttonColor) and on Android 16, React Native 0.84, new architecture.

The modal's alert controller takes buttonColor as its tint. The theme-derived default stays Android-only, so iOS apps without buttonColor keep the system blue. On iOS 26 a light buttonColor gives the filled confirm action a black label.
@loikfb

loikfb commented Oct 28, 2026

Copy link
Copy Markdown
Author

A note on the iOS 26 part, since it uses a private key: titleTextColor on UIAlertAction.

On iOS 26 the preferred action (Confirm) is filled with the tint under a white label. With a light buttonColor, typically in dark mode, that label becomes unreadable. UIKit has no public API to change it. I tried the public alternative of not setting preferredAction when the color is light. Confirm then becomes a plain grey button with a white label, like Cancel, so the color no longer shows at all.

The key is only set on iOS 26, only for a light buttonColor, and inside @try. If Apple removes it, the label falls back to white. If you'd rather keep private keys out of the library, I'm happy to drop that block. The rest of the PR stands on its own.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant