wip: Auth picker view picker content#1369
Conversation
…tomize the auth sheet's root and destination content without breaking the existing initializer
…on the auth-flow switch label
…theming of text fields and CTA buttons
…se remaining unstyled-text gaps across the auth flow
…ethodPicker:), with non-breaking AuthProviderAction dispatch for non-credential providers
There was a problem hiding this comment.
Code Review
This pull request introduces extensive customization capabilities for the Firebase SwiftUI Auth UI components, including custom styling for CTA buttons, text fields, typography, and customizable picker content/destinations. The review feedback highlights critical compilation errors in AuthTextField.swift and VerificationCodeInputField.swift due to calling .strikethrough on a custom view modifier instead of directly on Text. Additionally, it points out visual inconsistencies where custom fonts are applied to placeholders but not to the typed text of SecureField and TextField components.
| Text(validator.message) | ||
| .font(.caption) | ||
| .strikethrough(isValid, color: .gray) | ||
| .foregroundStyle(isValid ? .gray : .red) | ||
| .authFont(.caption) | ||
| .strikethrough(isValid, color: style.secondaryColor ?? .gray) | ||
| .foregroundStyle(isValid ? (style.secondaryColor ?? .gray) : (style.errorColor ?? .red)) | ||
| .fixedSize(horizontal: false, vertical: true) |
There was a problem hiding this comment.
This will cause a compilation error. .authFont(.caption) returns some View (since it is a custom view modifier), but .strikethrough is a modifier exclusive to Text. Calling .strikethrough on some View is not allowed. To fix this, apply .strikethrough directly to the Text view before applying .authFont.
| Text(validator.message) | |
| .font(.caption) | |
| .strikethrough(isValid, color: .gray) | |
| .foregroundStyle(isValid ? .gray : .red) | |
| .authFont(.caption) | |
| .strikethrough(isValid, color: style.secondaryColor ?? .gray) | |
| .foregroundStyle(isValid ? (style.secondaryColor ?? .gray) : (style.errorColor ?? .red)) | |
| .fixedSize(horizontal: false, vertical: true) | |
| Text(validator.message) | |
| .strikethrough(isValid, color: style.secondaryColor ?? .gray) | |
| .authFont(.caption) | |
| .foregroundStyle(isValid ? (style.secondaryColor ?? .gray) : (style.errorColor ?? .red)) | |
| .fixedSize(horizontal: false, vertical: true) |
| Text(validator.message) | ||
| .font(.caption) | ||
| .authFont(.caption) | ||
| .strikethrough(isValid, color: .gray) | ||
| .foregroundStyle(isValid ? .gray : .red) | ||
| .fixedSize(horizontal: false, vertical: true) |
There was a problem hiding this comment.
This will cause a compilation error. .authFont(.caption) returns some View (since it is a custom view modifier), but .strikethrough is a modifier exclusive to Text. Calling .strikethrough on some View is not allowed. To fix this, apply .strikethrough directly to the Text view before applying .authFont.
| Text(validator.message) | |
| .font(.caption) | |
| .authFont(.caption) | |
| .strikethrough(isValid, color: .gray) | |
| .foregroundStyle(isValid ? .gray : .red) | |
| .fixedSize(horizontal: false, vertical: true) | |
| Text(validator.message) | |
| .strikethrough(isValid, color: .gray) | |
| .authFont(.caption) | |
| .foregroundStyle(isValid ? .gray : .red) | |
| .fixedSize(horizontal: false, vertical: true) |
| SecureField(label, text: $text, prompt: Text(prompt).font(typography.resolvedFont(for: .body))) | ||
| .opacity(obscured ? 1 : 0) | ||
| .focused($isFocused) | ||
| .frame(height: 24) | ||
| TextField(label, text: $text, prompt: Text(prompt)) | ||
| TextField(label, text: $text, prompt: Text(prompt).font(typography.resolvedFont(for: .body))) | ||
| .opacity(obscured ? 0 : 1) | ||
| .focused($isFocused) | ||
| .frame(height: 24) |
There was a problem hiding this comment.
The custom font is explicitly applied to the placeholder (prompt) but not to the typed text of the SecureField and TextField themselves. This causes a visual inconsistency where the placeholder uses the custom font, but the user's typed input falls back to the system font. Applying .authFont(.body) directly to the text fields will style both the typed text and the placeholder consistently, allowing you to simplify the prompt parameter.
SecureField(label, text: $text, prompt: Text(prompt))
.authFont(.body)
.opacity(obscured ? 1 : 0)
.focused($isFocused)
.frame(height: 24)
TextField(label, text: $text, prompt: Text(prompt))
.authFont(.body)
.opacity(obscured ? 0 : 1)
.focused($isFocused)
.frame(height: 24)| TextField( | ||
| label, | ||
| text: $text, | ||
| prompt: Text(prompt) | ||
| prompt: Text(prompt).font(typography.resolvedFont(for: .body)) | ||
| ) | ||
| .frame(height: 24) | ||
| } |
There was a problem hiding this comment.
The custom font is explicitly applied to the placeholder (prompt) but not to the typed text of the TextField itself. Applying .authFont(.body) directly to the TextField will style both the typed text and the placeholder consistently, allowing you to simplify the prompt parameter.
TextField(
label,
text: $text,
prompt: Text(prompt)
)
.authFont(.body)
.frame(height: 24)
Preview