Assign orderIndex_ in ConcreteViewShadowNode constructor instead of ViewShadowNode'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
This commit is contained in:
Samuel Susla
2020-03-31 09:50:17 -07:00
committed by Facebook GitHub Bot
parent 214d73b5a2
commit 367a573ccc
2 changed files with 21 additions and 2 deletions
@@ -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;
@@ -84,6 +100,11 @@ class ConcreteViewShadowNode : public ConcreteShadowNode<
return list;
}
#endif
private:
void initialize() noexcept {
BaseShadowNode::orderIndex_ = BaseShadowNode::getConcreteProps().zIndex;
}
};
} // namespace react
@@ -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 ||