mirror of
https://github.com/status-im/react-native.git
synced 2025-02-25 15:45:32 +00:00
Fixed bug in defaultView logic
Summary: In my recent refactor to remove defaultViews, I added a check for null json values to determine if defaultView needed to be created. Unfortunately this was checking for nil instead of NSNull. Reviewed By: javache Differential Revision: D3058383 fb-gh-sync-id: 2a21dd0beb0302a94ed5379d39a102cde1316a9d shipit-source-id: 2a21dd0beb0302a94ed5379d39a102cde1316a9d
This commit is contained in:
parent
2273e012c0
commit
ded362af81
@ -88,7 +88,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)init)
|
|||||||
{
|
{
|
||||||
RCTAssertMainThread();
|
RCTAssertMainThread();
|
||||||
|
|
||||||
UIView *view = [_manager view];
|
UIView *view = [self.manager view];
|
||||||
view.reactTag = tag;
|
view.reactTag = tag;
|
||||||
view.multipleTouchEnabled = YES;
|
view.multipleTouchEnabled = YES;
|
||||||
view.userInteractionEnabled = YES; // required for touch handling
|
view.userInteractionEnabled = YES; // required for touch handling
|
||||||
@ -117,10 +117,9 @@ RCT_NOT_IMPLEMENTED(- (instancetype)init)
|
|||||||
SEL type = NULL;
|
SEL type = NULL;
|
||||||
NSString *keyPath = nil;
|
NSString *keyPath = nil;
|
||||||
SEL selector = NSSelectorFromString([NSString stringWithFormat:@"propConfig%@_%@", shadowView ? @"Shadow" : @"", name]);
|
SEL selector = NSSelectorFromString([NSString stringWithFormat:@"propConfig%@_%@", shadowView ? @"Shadow" : @"", name]);
|
||||||
Class managerClass = [_manager class];
|
if ([_managerClass respondsToSelector:selector]) {
|
||||||
if ([managerClass respondsToSelector:selector]) {
|
|
||||||
NSArray<NSString *> *typeAndKeyPath =
|
NSArray<NSString *> *typeAndKeyPath =
|
||||||
((NSArray<NSString *> *(*)(id, SEL))objc_msgSend)(managerClass, selector);
|
((NSArray<NSString *> *(*)(id, SEL))objc_msgSend)(_managerClass, selector);
|
||||||
type = RCTConvertSelectorForType(typeAndKeyPath[0]);
|
type = RCTConvertSelectorForType(typeAndKeyPath[0]);
|
||||||
keyPath = typeAndKeyPath.count > 1 ? typeAndKeyPath[1] : nil;
|
keyPath = typeAndKeyPath.count > 1 ? typeAndKeyPath[1] : nil;
|
||||||
} else {
|
} else {
|
||||||
@ -140,12 +139,13 @@ RCT_NOT_IMPLEMENTED(- (instancetype)init)
|
|||||||
if (!strongSelf) {
|
if (!strongSelf) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
json = RCTNilIfNull(json);
|
||||||
if (!json && !strongSelf->_defaultView) {
|
if (!json && !strongSelf->_defaultView) {
|
||||||
// Only create default view if json is null
|
// Only create default view if json is null
|
||||||
strongSelf->_defaultView = [strongSelf createViewWithTag:nil];
|
strongSelf->_defaultView = [strongSelf createViewWithTag:nil];
|
||||||
}
|
}
|
||||||
((void (*)(id, SEL, id, id, id))objc_msgSend)(
|
((void (*)(id, SEL, id, id, id))objc_msgSend)(
|
||||||
strongSelf.manager, customSetter, json == (id)kCFNull ? nil : json, view, strongSelf->_defaultView
|
strongSelf.manager, customSetter, json, view, strongSelf->_defaultView
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -173,7 +173,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)init)
|
|||||||
type == NSSelectorFromString(@"RCTDirectEventBlock:")) {
|
type == NSSelectorFromString(@"RCTDirectEventBlock:")) {
|
||||||
|
|
||||||
// Special case for event handlers
|
// Special case for event handlers
|
||||||
__weak RCTViewManager *weakManager = _manager;
|
__weak RCTViewManager *weakManager = self.manager;
|
||||||
setterBlock = ^(id target, id json) {
|
setterBlock = ^(id target, id json) {
|
||||||
__weak id<RCTComponent> weakTarget = target;
|
__weak id<RCTComponent> weakTarget = target;
|
||||||
((void (*)(id, SEL, id))objc_msgSend)(target, setter, [RCTConvert BOOL:json] ? ^(NSDictionary *body) {
|
((void (*)(id, SEL, id))objc_msgSend)(target, setter, [RCTConvert BOOL:json] ? ^(NSDictionary *body) {
|
||||||
@ -443,7 +443,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)init)
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
- (RCTViewManagerUIBlock)uiBlockToAmendWithShadowViewRegistry:(NSDictionary<NSNumber *,RCTShadowView *> *)registry
|
- (RCTViewManagerUIBlock)uiBlockToAmendWithShadowViewRegistry:(NSDictionary<NSNumber *, RCTShadowView *> *)registry
|
||||||
{
|
{
|
||||||
if (_implementsUIBlockToAmendWithShadowViewRegistry) {
|
if (_implementsUIBlockToAmendWithShadowViewRegistry) {
|
||||||
return [[self manager] uiBlockToAmendWithShadowViewRegistry:registry];
|
return [[self manager] uiBlockToAmendWithShadowViewRegistry:registry];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user