mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-24 04:16:00 +08:00
Allow to set refresh control title color
Summary:Closes #6812  Closes https://github.com/facebook/react-native/pull/6970 Differential Revision: D3189244 fb-gh-sync-id: 7625b6ab5859aaa20bc0cb379855c5daeb584abf fbshipit-source-id: 7625b6ab5859aaa20bc0cb379855c5daeb584abf
This commit is contained in:
committed by
Facebook Github Bot 3
parent
083bad44b2
commit
849a0f31ac
@@ -89,7 +89,18 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)aDecoder)
|
||||
|
||||
- (void)setTitle:(NSString *)title
|
||||
{
|
||||
self.attributedTitle = [[NSAttributedString alloc] initWithString:title];
|
||||
NSRange range = NSMakeRange(0, self.attributedTitle.length);
|
||||
NSDictionary *attrs = [self.attributedTitle attributesAtIndex:0 effectiveRange: &range];
|
||||
self.attributedTitle = [[NSAttributedString alloc] initWithString:title attributes:attrs];
|
||||
}
|
||||
|
||||
- (void)setTitleColor:(UIColor *)color
|
||||
{
|
||||
NSRange range = NSMakeRange(0, self.attributedTitle.length);
|
||||
NSDictionary *attrs = [self.attributedTitle attributesAtIndex:0 effectiveRange: &range];
|
||||
NSMutableDictionary *attrsMutable = [attrs mutableCopy];
|
||||
[attrsMutable setObject:color forKey:NSForegroundColorAttributeName];
|
||||
self.attributedTitle = [[NSAttributedString alloc] initWithString:self.attributedTitle.string attributes:attrsMutable];
|
||||
}
|
||||
|
||||
- (void)setRefreshing:(BOOL)refreshing
|
||||
|
||||
@@ -24,5 +24,6 @@ RCT_EXPORT_VIEW_PROPERTY(onRefresh, RCTDirectEventBlock)
|
||||
RCT_EXPORT_VIEW_PROPERTY(refreshing, BOOL)
|
||||
RCT_EXPORT_VIEW_PROPERTY(tintColor, UIColor)
|
||||
RCT_EXPORT_VIEW_PROPERTY(title, NSString)
|
||||
RCT_EXPORT_VIEW_PROPERTY(titleColor, UIColor)
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user