Skip to content

Commit

Permalink
fix(ios): color property does not work with showCancel property in se…
Browse files Browse the repository at this point in the history
…arch bar (#11573)

Fixes TIMOB-27820
  • Loading branch information
vijaysingh-axway committed Apr 9, 2020
1 parent 960d208 commit e013135
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions iphone/Classes/TiUISearchBar.m
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,18 @@ - (void)setShowCancel_:(id)value
UISearchBar *search = [self searchBar];
[search setShowsCancelButton:[TiUtils boolValue:value]];
[search sizeToFit];

id textColor = [[self proxy] valueForUndefinedKey:@"color"];
if ([TiUtils isIOSVersionLower:@"11.0"] && textColor) {
UIView *searchContainerView = self.searchBar.subviews.firstObject;

[searchContainerView.subviews enumerateObjectsUsingBlock:^(__kindof UIView *_Nonnull obj, NSUInteger idx, BOOL *_Nonnull stop) {
if ([obj isKindOfClass:[UITextField class]]) {
((UITextField *)obj).textColor = [[TiUtils colorValue:textColor] _color];
*stop = YES;
}
}];
}
}

- (void)setHintText_:(id)value
Expand Down

0 comments on commit e013135

Please sign in to comment.