fix: support hintTextColor on iOS search bar#4089
Open
skrtdev wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds iOS support for the hintTextColor SearchBar option by applying it to the iOS search bar placeholder and keeping the placeholder string stable across hint color updates. This also updates the public types/spec so hintTextColor is no longer presented as Android-only.
Changes:
- Apply
hintTextColorto the iOSUISearchTextFieldplaceholder viaattributedPlaceholder. - Persist placeholder text in native (
_placeholder) so changing hint color doesn’t unintentionally change placeholder content. - Update TypeScript types/codegen spec to treat
hintTextColoras non-Android-only.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/types.tsx | Removes Android-only annotation from hintTextColor in SearchBarProps docs. |
| src/fabric/SearchBarNativeComponent.ts | Moves hintTextColor into the shared prop set (not under “Android only”). |
| ios/RNSSearchBar.mm | Implements setHintTextColor, stores placeholder, and updates Fabric + legacy prop export. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
59
to
+63
| // TODO: implement these on iOS | ||
| barTintColor?: ColorValue | undefined; | ||
| tintColor?: ColorValue | undefined; | ||
| textColor?: ColorValue | undefined; | ||
| hintTextColor?: ColorValue | undefined; |
Comment on lines
+211
to
+216
| if (_hintTextColor != nil && _placeholder != nil) { | ||
| _controller.searchBar.searchTextField.attributedPlaceholder = | ||
| [[NSAttributedString alloc] initWithString:_placeholder attributes:@{NSForegroundColorAttributeName : _hintTextColor}]; | ||
| } else { | ||
| [_controller.searchBar setPlaceholder:_placeholder]; | ||
| } |
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.
Summary
hintTextColorto the iOS search bar placeholderhintTextColoris no longer marked Android-onlyTest plan
git diff --checkclang-formatand full package checks were not run locally because this environment does not have the repo toolchain installed.