Convert alloc/init to new to please linter

This commit is contained in:
Nick Lockwood
2015-08-17 07:35:34 -07:00
parent 869ff92dbc
commit 8d1e02b8bd
74 changed files with 172 additions and 172 deletions

View File

@@ -17,7 +17,7 @@ RCT_EXPORT_MODULE()
- (RCTShadowView *)shadowView
{
return [[RCTShadowRawText alloc] init];
return [RCTShadowRawText new];
}
RCT_EXPORT_SHADOW_PROPERTY(text, NSString)

View File

@@ -111,12 +111,12 @@ static css_dim_t RCTMeasure(void *context, float width)
return _cachedTextStorage;
}
NSLayoutManager *layoutManager = [[NSLayoutManager alloc] init];
NSLayoutManager *layoutManager = [NSLayoutManager new];
NSTextStorage *textStorage = [[NSTextStorage alloc] initWithAttributedString:self.attributedString];
[textStorage addLayoutManager:layoutManager];
NSTextContainer *textContainer = [[NSTextContainer alloc] init];
NSTextContainer *textContainer = [NSTextContainer new];
textContainer.lineFragmentPadding = 0.0;
textContainer.lineBreakMode = _numberOfLines > 0 ? NSLineBreakByTruncatingTail : NSLineBreakByClipping;
textContainer.maximumNumberOfLines = _numberOfLines;
@@ -183,7 +183,7 @@ static css_dim_t RCTMeasure(void *context, float width)
_effectiveLetterSpacing = letterSpacing.doubleValue;
NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] init];
NSMutableAttributedString *attributedString = [NSMutableAttributedString new];
for (RCTShadowView *child in [self reactSubviews]) {
if ([child isKindOfClass:[RCTShadowText class]]) {
RCTShadowText *shadowText = (RCTShadowText *)child;
@@ -265,7 +265,7 @@ static css_dim_t RCTMeasure(void *context, float width)
// if we found anything, set it :D
if (hasParagraphStyle) {
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
NSMutableParagraphStyle *paragraphStyle = [NSMutableParagraphStyle new];
paragraphStyle.alignment = _textAlign;
paragraphStyle.baseWritingDirection = _writingDirection;
CGFloat lineHeight = round(_lineHeight * self.fontSizeMultiplier);

View File

@@ -23,7 +23,7 @@
- (instancetype)initWithFrame:(CGRect)frame
{
if ((self = [super initWithFrame:frame])) {
_textStorage = [[NSTextStorage alloc] init];
_textStorage = [NSTextStorage new];
_reactSubviews = [NSMutableArray array];
self.isAccessibilityElement = YES;

View File

@@ -31,7 +31,7 @@
[self addTarget:self action:@selector(textFieldBeginEditing) forControlEvents:UIControlEventEditingDidBegin];
[self addTarget:self action:@selector(textFieldEndEditing) forControlEvents:UIControlEventEditingDidEnd];
[self addTarget:self action:@selector(textFieldSubmitEditing) forControlEvents:UIControlEventEditingDidEndOnExit];
_reactSubviews = [[NSMutableArray alloc] init];
_reactSubviews = [NSMutableArray new];
}
return self;
}

View File

@@ -25,12 +25,12 @@ RCT_EXPORT_MODULE()
- (UIView *)view
{
return [[RCTText alloc] init];
return [RCTText new];
}
- (RCTShadowView *)shadowView
{
return [[RCTShadowText alloc] init];
return [RCTShadowText new];
}
#pragma mark - Shadow properties