[ReactNative] Unforked RCTShadowView, moved RKTextView into FBReactKitTextModule

This commit is contained in:
Nick Lockwood 2015-03-17 03:51:58 -07:00
parent d8ee4e87a1
commit 1decb7e1cb
4 changed files with 17 additions and 13 deletions

View File

@ -718,7 +718,7 @@ static void RCTSetShadowViewProps(NSDictionary *props, RCTShadowView *shadowView
}
RCTShadowView *shadowView = [manager shadowView];
shadowView.moduleName = viewName;
shadowView.viewName = viewName;
shadowView.reactTag = reactTag;
RCTSetShadowViewProps(props, shadowView, _defaultShadowViews[viewName], manager);
_shadowViewRegistry[shadowView.reactTag] = shadowView;
@ -973,8 +973,7 @@ static void RCTSetShadowViewProps(NSDictionary *props, RCTShadowView *shadowView
NSMutableArray *results = [[NSMutableArray alloc] initWithCapacity:[childShadowViews count]];
CGRect layoutRect = [RCTConvert CGRect:rect];
for (int ii = 0; ii < [childShadowViews count]; ii++) {
RCTShadowView *childShadowView = [childShadowViews objectAtIndex:ii];
[childShadowViews enumerateObjectsUsingBlock:^(RCTShadowView *childShadowView, NSUInteger idx, BOOL *stop) {
CGRect childLayout = [RCTShadowView measureLayout:childShadowView relativeTo:shadowView];
if (CGRectIsNull(childLayout)) {
RCTLogError(@"View %@ (tag #%@) is not a decendant of %@ (tag #%@)",
@ -992,7 +991,7 @@ static void RCTSetShadowViewProps(NSDictionary *props, RCTShadowView *shadowView
topOffset <= layoutRect.origin.y + layoutRect.size.height &&
topOffset + height >= layoutRect.origin.y) {
// This view is within the layout rect
NSDictionary *result = @{@"index": @(ii),
NSDictionary *result = @{@"index": @(idx),
@"left": @(leftOffset),
@"top": @(topOffset),
@"width": @(width),
@ -1000,7 +999,7 @@ static void RCTSetShadowViewProps(NSDictionary *props, RCTShadowView *shadowView
[results addObject:result];
}
}
}];
callback(@[results]);
}

View File

@ -2,8 +2,8 @@
#import <UIKit/UIKit.h>
#import "Layout.h"
#import "RCTUIManager.h"
#import "../Layout/Layout.h"
#import "RCTViewNodeProtocol.h"
@class RCTSparseArray;
@ -31,7 +31,7 @@ typedef void (^RCTApplierBlock)(RCTSparseArray *);
@property (nonatomic, weak, readonly) RCTShadowView *superview;
@property (nonatomic, assign, readonly) css_node_t *cssNode;
@property (nonatomic, copy) NSString *moduleName;
@property (nonatomic, copy) NSString *viewName;
@property (nonatomic, assign) BOOL isBGColorExplicitlySet; // Used to propagate to children
@property (nonatomic, strong) UIColor *backgroundColor; // Used to propagate to children
@property (nonatomic, assign) RCTUpdateLifecycle layoutLifecycle;
@ -54,6 +54,9 @@ typedef void (^RCTApplierBlock)(RCTSparseArray *);
*/
@property (nonatomic, assign) CGFloat top;
@property (nonatomic, assign) CGFloat left;
@property (nonatomic, assign) CGFloat bottom;
@property (nonatomic, assign) CGFloat right;
@property (nonatomic, assign) CGFloat width;
@property (nonatomic, assign) CGFloat height;
@property (nonatomic, assign) CGRect frame;
@ -66,8 +69,8 @@ typedef void (^RCTApplierBlock)(RCTSparseArray *);
*/
@property (nonatomic, assign) CGFloat borderTop;
@property (nonatomic, assign) CGFloat borderLeft;
@property (nonatomic, assign) CGFloat borderWidth;
@property (nonatomic, assign) CGFloat borderHeight;
@property (nonatomic, assign) CGFloat borderBottom;
@property (nonatomic, assign) CGFloat borderRight;
- (void)setBorderWidth:(CGFloat)value;

View File

@ -44,7 +44,7 @@ typedef enum {
static void RCTPrint(void *context)
{
RCTShadowView *shadowView = (__bridge RCTShadowView *)context;
printf("%s(%zd), ", [[shadowView moduleName] UTF8String], [[shadowView reactTag] integerValue]);
printf("%s(%zd), ", shadowView.viewName.UTF8String, shadowView.reactTag.integerValue);
}
static css_node_t *RCTGetChild(void *context, int i)
@ -132,12 +132,13 @@ static void RCTProcessMetaProps(const float metaProps[META_PROP_COUNT], float st
RCTRoundPixelValue(absolutePosition.y + node->layout.position[CSS_TOP] + node->layout.dimensions[CSS_HEIGHT])
};
CGRect frame = {
CGRect frame = {{
RCTRoundPixelValue(node->layout.position[CSS_LEFT]),
RCTRoundPixelValue(node->layout.position[CSS_TOP]),
}, {
RCTRoundPixelValue(absoluteBottomRight.x - absoluteTopLeft.x),
RCTRoundPixelValue(absoluteBottomRight.y - absoluteTopLeft.y)
};
}};
if (!CGRectEqualToRect(frame, _frame)) {
_frame = frame;

View File

@ -2,6 +2,7 @@
#import "RCTTextFieldManager.h"
#import "RCTBridge.h"
#import "RCTConvert.h"
#import "RCTShadowView.h"
#import "RCTSparseArray.h"