Skip to content

Commit

Permalink
Assign orderIndex_ in ConcreteViewShadowNode constructor instead of V…
Browse files Browse the repository at this point in the history
…iewShadowNode's constructor

Summary:
Changelog: [Internal]

`orderIndex_` was only being assigned for `ViewShadowNode`, not for other `ShadowNodes` that are later represented on the screen.

Reviewed By: shergin

Differential Revision: D20746477

fbshipit-source-id: c04c2cfea14b9141d22bc3d9e9bb4c0c59925754
  • Loading branch information
sammy-SC authored and facebook-github-bot committed Mar 31, 2020
1 parent 214d73b commit 367a573
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
21 changes: 21 additions & 0 deletions ReactCommon/fabric/components/view/ConcreteViewShadowNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,22 @@ class ConcreteViewShadowNode : public ConcreteShadowNode<
ViewPropsT,
ViewEventEmitterT,
Ts...>;

ConcreteViewShadowNode(
ShadowNodeFragment const &fragment,
ShadowNodeFamily::Shared const &family,
ShadowNodeTraits traits)
: BaseShadowNode(fragment, family, traits) {
initialize();
}

ConcreteViewShadowNode(
ShadowNode const &sourceShadowNode,
ShadowNodeFragment const &fragment)
: BaseShadowNode(sourceShadowNode, fragment) {
initialize();
}

using ConcreteViewProps = ViewPropsT;

using BaseShadowNode::BaseShadowNode;
Expand Down Expand Up @@ -84,6 +100,11 @@ class ConcreteViewShadowNode : public ConcreteShadowNode<
return list;
}
#endif

private:
void initialize() noexcept {
BaseShadowNode::orderIndex_ = BaseShadowNode::getConcreteProps().zIndex;
}
};

} // namespace react
Expand Down
2 changes: 0 additions & 2 deletions ReactCommon/fabric/components/view/ViewShadowNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ static bool isColorMeaningful(SharedColor const &color) noexcept {
void ViewShadowNode::initialize() noexcept {
auto &viewProps = static_cast<ViewProps const &>(*props_);

orderIndex_ = viewProps.zIndex;

bool formsStackingContext = !viewProps.collapsable ||
viewProps.pointerEvents == PointerEventsMode::None ||
!viewProps.nativeId.empty() || viewProps.accessible ||
Expand Down

0 comments on commit 367a573

Please sign in to comment.