[rn] Pass props when creating a view in RCTViewManager

This commit is contained in:
Matt Mahoney
2015-08-25 07:45:07 -07:00
parent 27a67c2434
commit 36c1064033
5 changed files with 19 additions and 5 deletions

View File

@@ -62,11 +62,11 @@ typedef void (^RCTPropBlock)(id<RCTComponent> view, id json);
RCT_NOT_IMPLEMENTED(- (instancetype)init)
- (id<RCTComponent>)createViewWithTag:(NSNumber *)tag
- (id<RCTComponent>)createViewWithTag:(NSNumber *)tag props:(NSDictionary *)props
{
RCTAssertMainThread();
id<RCTComponent> view = (id<RCTComponent>)[_manager view];
id<RCTComponent> view = (id<RCTComponent>)(props ? [_manager viewWithProps:props] : [_manager view]);
view.reactTag = tag;
if ([view isKindOfClass:[UIView class]]) {
((UIView *)view).multipleTouchEnabled = YES;
@@ -264,7 +264,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)init)
}
if (!_defaultView) {
_defaultView = [self createViewWithTag:nil];
_defaultView = [self createViewWithTag:nil props:nil];
}
[props enumerateKeysAndObjectsUsingBlock:^(NSString *key, id json, __unused BOOL *stop) {