Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: change the search icon's color according to search bar's state #2068

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Cancercookie
Copy link

Description

In our project we have the following configuration:

{
  barTintColor: theme.neutral100w,
  hideWhenScrolling: false,
  tintColor: "white",
  headerIconColor: "white",
  hideNavigationBar: true,
  placeholder: LABELS.SEARCH_PLACEHOLDER,
  hintTextColor: "gray",
  shouldShowHintSearchIcon: false,
}

that on Android gives us:

Screenshot 2024-03-19 at 10 59 16

what happens is that because of headerIconColor: "white" we get this result on open:

Screenshot 2024-03-19 at 10 59 24

What happens is that headerIconColor is applied to the clear icon too, making it blend with the background.

I've tried implementing a solution to set the same color as hintTextColor in our codebase using onOpen and onClose events but it was unstable.

Changes

It makes sense to me that the color of the clear icon should follow hintTextColor when search is opened.
What I propose is setting the color once when we land on the page and then setting it again according to search state each time setToolbarElementsVisibility gets called

Screenshots / GIFs

The end result:

Screenshot 2024-03-19 at 11 12 53 Screenshot 2024-03-19 at 11 12 48

Test code and steps to reproduce

  • Use the previous configuration as values for headerSearchBarOptions in any Screen.
  • Open/close search field

Checklist

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.

None yet

1 participant