Repository navigation
fix(search-bar): style the typed text and drive Cancel from focus - #31
Open
romchornyi wants to merge 1 commit into
Open
romchornyi wants to merge 1 commit into
romchornyi wants to merge 1 commit into
Conversation
The field styled only its prompt. Typed text fell back to the system body font in `.primary`, so the line grew from 15pt to 17pt on the first keystroke and did not use the design-system colour. It now uses `.dashFont(.subhead)` and `Color.dash.primaryText`, the same modifiers as `AddressFieldView`. The Cancel button followed a `@State` copy of the focus state, synced in `onAppear` and `onChange`, and each focus change was animated three times. It now reads `isFocused` directly, with one `.animation(value:)`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Issue being fixed or feature implemented
Closes #26.
SearchBarstyled only its placeholder. The text you type fell back to the system body font (17pt) in.primary, while the placeholder is.subhead(15pt). So the line changed size on the first keystroke and did not use the design-system colour. dashwallet-ios uses this field inLocalCurrencyViewandSelectCoinView.What was done?
.dashFont(.subhead)andColor.dash.primaryText. These are the same modifiersAddressFieldViewuses, so the two fields render typed text the same way..dashFontadds about 1pt of line-height padding, which fits inside the 40pt field.@FocusState isFocuseddirectly. The@State isEditingcopy is gone, along with theonAppearsync, theonChangeand bothwithAnimationblocks..animation(_:value: isFocused)now covers what was animated three times.onAppearsync never had any effect:@FocusStateis alwaysfalseon first appearance, and the host cannot focus this field from outside.docs/buttons-and-inputs.mddescribes the focus-driven Cancel button and the typed-text style.How Has This Been Tested?
swift build,swift testandxcodebuild build-for-testingfor the iOS Simulator are clean, with no warnings.primaryText.develop(LocalCurrencyView,SelectCoinView) sets no font or colour onSearchBar, so nothing there is overridden.Breaking Changes
None. The public API is unchanged.
One behaviour to know: typed text is now a fixed 15pt, like every
Font.dashtoken, the placeholder andAddressFieldView. Before, it was the system body style, which scaled with Dynamic Type. The docs say so.Checklist:
🤖 Generated with Claude Code