@ericlewis I may be wrong but it looks like your PR sets tintColor, not barTintColor which would change the background.
@chrise86 tintColor is correct when dealing with UISearchController. I tested this in my own application already.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If you believe the issue is still relevant, please test on the latest Detox and report back. Thank you for your contributions.
The issue has been closed for inactivity.
Can this be reopened that would be awesome!! Thanks
Have the same problem, has anyone found a solution for this?
@kgaspar i had to get under the ol' hood and tweak it myself:
Just after line 49 in the _UiViewController+RNNOptions.m_ file (located in ReactNativeNavigation.xcodeproj), I added
search.searchBar.tintColor = [UIColor colorWithRed:0.59 green:0.59 blue:0.59 alpha:1.0];
and was able to successfully alter the color of the cancel button
If you don't want to mess with the code of RNN you could just add this line of code to your AppDelegate.m
file in the didFinishLaunchingWithOptions
method:
[[UISearchBar appearanceWhenContainedInInstancesOfClasses:@[[UIViewController class]]] setTintColor:[UIColor
colorWithRed:245.0/255.0
green:166.0/255.0
blue:34.0/255.0
alpha:1.0]];
Add any UIColor
you like. :)
@jjbeach Thanks for the help, I implemented the tintColor and the button looks good now. Have you managed to change the barTintColor? To change the color of the Search Bar Background. R
Hi I managed to make the Search Bar background white with this code, added under @jjbeach solution:
search.searchBar.tintColor = UIColor.whiteColor;
search.searchBar.barTintColor = UIColor.whiteColor;
UITextField *txfSearchField = [search.searchBar valueForKey:@"_searchField"];
txfSearchField.tintColor=[UIColor colorWithRed:21/255.0 green:157/255.0 blue:130/255.0 alpha:1];
txfSearchField.textColor=[UIColor colorWithRed:1 green:1 blue:1 alpha:1];
txfSearchField.backgroundColor=[UIColor whiteColor];
UIView *backgroundview= [[txfSearchField subviews]firstObject ];
backgroundview.backgroundColor=[UIColor whiteColor];
backgroundview.layer.cornerRadius = 8;
backgroundview.clipsToBounds = true;
@yogevbd Seeing that #4055 was abandoned, lets add the following options:
searchBarCursorColor
(maps to tintColor in native)searchBarTextColor
searchBarKeyboardStyle: 'dark'|'light'
Are you planning to implement this feature in the future?
Any updates ?
@guyca hey, any updates on that?
@mrousavy Seems like the commit you've linked and @mateioprea's PR will resolve this issue. We'll probably land it some time next week.
Most helpful comment
@yogevbd Seeing that #4055 was abandoned, lets add the following options:
searchBarCursorColor
(maps to tintColor in native)searchBarTextColor
searchBarKeyboardStyle: 'dark'|'light'