Skip to content

Conversation

@snehitha-30727
Copy link
Contributor

@snehitha-30727 snehitha-30727 commented Oct 29, 2025

PR Checklist


What is the current behavior?

Currently, the SearchBar component on Android does not allow developers to customize the clear button color.
This results in inconsistency with iOS, where developers can already modify the color to match app themes.


What is the new behavior?

This PR introduces support for customizing the clear button color in the SearchBar component on Android.
Developers can now apply any desired color for consistent design and theming across platforms.

Fixes #5193


Example Usage:

const searchBar = new SearchBar();
searchBar.clearButtonColor = new Color('#FF4081');

@snehitha-30727
Copy link
Contributor Author

Fixed issue #5193 — added support for clear button color in SearchBar (Android).

@NathanWalker NathanWalker added this to the 9.0 milestone Oct 29, 2025
@NathanWalker NathanWalker requested a review from Copilot October 29, 2025 18:20
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for customizing the clear button color in the SearchBar component across iOS and Android platforms. The change introduces a new clearButtonColor property that allows developers to style the clear/close button.

  • Added clearButtonColorProperty to the SearchBar common properties
  • Implemented platform-specific handlers for iOS using tintColor on the clear button
  • Implemented platform-specific handlers for Android using setColorFilter on the close button

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
packages/core/ui/search-bar/search-bar-common.ts Defines the new clearButtonColorProperty with Color type and equality comparer
packages/core/ui/search-bar/index.ios.ts Implements iOS-specific handler using valueForKey('clearButton') and tintColor
packages/core/ui/search-bar/index.android.ts Implements Android-specific handler using resource ID lookup and setColorFilter
Comments suppressed due to low confidence (1)

packages/core/ui/search-bar/search-bar-common.ts:14

  • The clearButtonColor property declaration is missing from the SearchBarBase class. Add public clearButtonColor: Color; after line 14 to maintain consistency with other properties like textFieldBackgroundColor and textFieldHintColor.
export abstract class SearchBarBase extends View implements SearchBarDefinition {
	public static submitEvent = 'submit';
	public static clearEvent = 'clear';

	public text: string;
	public hint: string;
	public textFieldBackgroundColor: Color;
	public textFieldHintColor: Color;

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@nx-cloud
Copy link

nx-cloud bot commented Oct 30, 2025

View your CI Pipeline Execution ↗ for commit 8bb0dc2

Command Status Duration Result
nx test apps-automated -c=ios ✅ Succeeded 2m 51s View ↗
nx run-many --target=test --configuration=ci --... ✅ Succeeded 2s View ↗

☁️ Nx Cloud last updated this comment at 2025-11-01 15:48:28 UTC

@NathanWalker NathanWalker changed the title fix(search-bar): add clear button color support on Android feat(search-bar): add clear button color support Nov 1, 2025
@NathanWalker NathanWalker merged commit 3be20a3 into NativeScript:main Nov 1, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SearchBar: ability to change color of clear button ("X")

4 participants