Skip to content

SearchBar: style the typed text and drop the isEditing mirror of the focus state #26

Open

Description

@romchornyi

Summary

These defects were found while reviewing #15. They were already on iOS 18 before that PR, so they are not regressions: #15 only removed the iOS 15/16 branch.

  1. Typed text has no design-system style. The TextField in Components/SearchBar.swift (searchField) styles its prompt with Font.dash.subhead / black1000Alpha30, but the typed text gets no font or colour. The text you type is therefore system body (17pt) in .primary, while the placeholder is subhead (15pt). In dashwallet-ios (LocalCurrencyView, SelectCoinView), the line visibly changes size on the first keystroke. The removed iOS 15/16 branch at least set foregroundColor(Color.dash.primaryText). Fix: .font(Font.dash.subhead).foregroundStyle(Color.dash.primaryText) on the field, the same way AddressFieldView does it.
  2. isEditing duplicates isFocused. @State isEditing mirrors @FocusState isFocused through an onAppear sync and an onChange copy, and the cancel button writes both. On top of that, the change is animated three times: withAnimation in onChange, .animation(value: isEditing) on the container, and again in the cancel action. Driving everything from isFocused alone removes the mirror and the double animation. Check that the cancel slide-in and slide-out animation stays the same.

How to check

Type into the search field in LocalCurrencyView. The placeholder and the typed text should match in size and colour. Then tap Cancel: the animation should run once.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions