Skip to content

Commit

Permalink
Fabric: Removing of all unnececery nil checks in RCTMountingManager
Browse files Browse the repository at this point in the history
Summary: We needed that in the very beginning when diffing algorithm produces mount instructions for <Text> nodes which don't have ComponentView representation, so we simply silence those error here. That's not the case anymore, so we don't need those ugly checks.

Reviewed By: JoshuaGross

Differential Revision: D15296473

fbshipit-source-id: ea3717062056907e5395776fe95e3d581d3e9b09
  • Loading branch information
shergin authored and facebook-github-bot committed May 10, 2019
1 parent 9e3856f commit 16499c1
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions React/Fabric/Mounting/RCTMountingManager.mm
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,7 @@ static void RNDeleteMountInstruction(ShadowViewMutation const &mutation, RCTComp
auto const &oldChildShadowView = mutation.oldChildShadowView;
UIView<RCTComponentViewProtocol> *componentView = [registry componentViewByTag:oldChildShadowView.tag];

// TODO(shergin): Make sure that we don't need this check anymore and delete it.
if (componentView == nil) {
return;
}
assert(componentView != nil && "Attempt to delete unregistered component.");

[registry enqueueComponentViewWithComponentHandle:oldChildShadowView.componentHandle
tag:oldChildShadowView.tag
Expand All @@ -55,10 +52,8 @@ static void RNInsertMountInstruction(ShadowViewMutation const &mutation, RCTComp
UIView<RCTComponentViewProtocol> *childComponentView = [registry componentViewByTag:newShadowView.tag];
UIView<RCTComponentViewProtocol> *parentComponentView = [registry componentViewByTag:parentShadowView.tag];

// TODO(shergin): Make sure that we don't need this check anymore and delete it.
if (childComponentView == nil || parentComponentView == nil) {
return;
}
assert(childComponentView != nil && "Attempt to mount unregistered component.");
assert(parentComponentView != nil && "Attempt to mount into unregistered component.");

[parentComponentView mountChildComponentView:childComponentView index:mutation.index];
}
Expand All @@ -72,10 +67,8 @@ static void RNRemoveMountInstruction(ShadowViewMutation const &mutation, RCTComp
UIView<RCTComponentViewProtocol> *childComponentView = [registry componentViewByTag:oldShadowView.tag];
UIView<RCTComponentViewProtocol> *parentComponentView = [registry componentViewByTag:parentShadowView.tag];

// TODO(shergin): Make sure that we don't need this check anymore and delete it.
if (childComponentView == nil || parentComponentView == nil) {
return;
}
assert(childComponentView != nil && "Attempt to unmount unregistered component.");
assert(parentComponentView != nil && "Attempt to unmount from unregistered component.");

[parentComponentView unmountChildComponentView:childComponentView index:mutation.index];
}
Expand Down

0 comments on commit 16499c1

Please sign in to comment.