Fixed nil insert crash in shadowViewRegistry
Summary: public In iOS < 9, inserting a nil object into NSMutableDictionary crashes. It is valid for come components to return a nil shadowView (e.g. ART nodes), and this was crashing on iOS 8. Reviewed By: jspahrsummers Differential Revision: D2658309 fb-gh-sync-id: 7abf9273708cc03c3b6307b69ba11c016b471fbe
This commit is contained in:
parent
d63d2071f9
commit
b7f5062128
|
@ -795,8 +795,10 @@ RCT_EXPORT_METHOD(createView:(nonnull NSNumber *)reactTag
|
||||||
|
|
||||||
// Register shadow view
|
// Register shadow view
|
||||||
RCTShadowView *shadowView = [componentData createShadowViewWithTag:reactTag];
|
RCTShadowView *shadowView = [componentData createShadowViewWithTag:reactTag];
|
||||||
[componentData setProps:props forShadowView:shadowView];
|
if (shadowView) {
|
||||||
_shadowViewRegistry[reactTag] = shadowView;
|
[componentData setProps:props forShadowView:shadowView];
|
||||||
|
_shadowViewRegistry[reactTag] = shadowView;
|
||||||
|
}
|
||||||
|
|
||||||
// Shadow view is the source of truth for background color this is a little
|
// Shadow view is the source of truth for background color this is a little
|
||||||
// bit counter-intuitive if people try to set background color when setting up
|
// bit counter-intuitive if people try to set background color when setting up
|
||||||
|
@ -805,14 +807,16 @@ RCT_EXPORT_METHOD(createView:(nonnull NSNumber *)reactTag
|
||||||
|
|
||||||
[self addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry){
|
[self addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry){
|
||||||
UIView *view = [componentData createViewWithTag:reactTag props:props];
|
UIView *view = [componentData createViewWithTag:reactTag props:props];
|
||||||
if ([view respondsToSelector:@selector(setBackgroundColor:)]) {
|
if (view) {
|
||||||
((UIView *)view).backgroundColor = backgroundColor;
|
if ([view respondsToSelector:@selector(setBackgroundColor:)]) {
|
||||||
|
((UIView *)view).backgroundColor = backgroundColor;
|
||||||
|
}
|
||||||
|
[componentData setProps:props forView:view];
|
||||||
|
if ([view respondsToSelector:@selector(reactBridgeDidFinishTransaction)]) {
|
||||||
|
[uiManager->_bridgeTransactionListeners addObject:view];
|
||||||
|
}
|
||||||
|
((NSMutableDictionary<NSNumber *, UIView *> *)viewRegistry)[reactTag] = view;
|
||||||
}
|
}
|
||||||
[componentData setProps:props forView:view];
|
|
||||||
if ([view respondsToSelector:@selector(reactBridgeDidFinishTransaction)]) {
|
|
||||||
[uiManager->_bridgeTransactionListeners addObject:view];
|
|
||||||
}
|
|
||||||
((NSMutableDictionary<NSNumber *, UIView *> *)viewRegistry)[reactTag] = view;
|
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue