[React Native] Remove layout-only nodes from RCTText in RN OSS

This commit is contained in:
Alex Akers 2015-05-29 06:04:05 -07:00
parent 40da2c7e08
commit 4097459dc9
1 changed files with 17 additions and 0 deletions

View File

@ -16,12 +16,14 @@
@implementation RCTText @implementation RCTText
{ {
NSTextStorage *_textStorage; NSTextStorage *_textStorage;
NSMutableArray *_reactSubviews;
} }
- (instancetype)initWithFrame:(CGRect)frame - (instancetype)initWithFrame:(CGRect)frame
{ {
if ((self = [super initWithFrame:frame])) { if ((self = [super initWithFrame:frame])) {
_textStorage = [[NSTextStorage alloc] init]; _textStorage = [[NSTextStorage alloc] init];
_reactSubviews = [NSMutableArray array];
self.isAccessibilityElement = YES; self.isAccessibilityElement = YES;
self.accessibilityTraits |= UIAccessibilityTraitStaticText; self.accessibilityTraits |= UIAccessibilityTraitStaticText;
@ -41,6 +43,21 @@
}]; }];
} }
- (void)insertReactSubview:(UIView *)subview atIndex:(NSInteger)atIndex
{
[_reactSubviews insertObject:subview atIndex:atIndex];
}
- (void)removeReactSubview:(UIView *)subview
{
[_reactSubviews removeObject:subview];
}
- (NSMutableArray *)reactSubviews
{
return _reactSubviews;
}
- (void)setTextStorage:(NSTextStorage *)textStorage - (void)setTextStorage:(NSTextStorage *)textStorage
{ {
_textStorage = textStorage; _textStorage = textStorage;