mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Fabric: Implementation of ViewProps::zIndex feature in C++ core
Summary: Now, having `orderIndex` feature in the core, we can use it for implementing `zIndex` feature. All we need to do is just to assign this `zIndex` value to `orderIndex`. Then we will use this to remove some platform-specific code that implements `zIndex` on the mounting layer. Changelog: [Internal] Fabric-specific internal change. Reviewed By: sammy-SC Differential Revision: D20432155 fbshipit-source-id: b4d62b63006f45899de38e1f40b1dfbe69550ada
This commit is contained in:
committed by
Facebook GitHub Bot
parent
ca35bfe597
commit
14a174c237
@@ -11,24 +11,24 @@
|
||||
namespace facebook {
|
||||
namespace react {
|
||||
|
||||
const char ViewComponentName[] = "View";
|
||||
char const ViewComponentName[] = "View";
|
||||
|
||||
ViewShadowNode::ViewShadowNode(
|
||||
ShadowNodeFragment const &fragment,
|
||||
ShadowNodeFamily::Shared const &family,
|
||||
ShadowNodeTraits traits)
|
||||
: ConcreteViewShadowNode(fragment, family, traits) {
|
||||
updateTraits();
|
||||
initialize();
|
||||
}
|
||||
|
||||
ViewShadowNode::ViewShadowNode(
|
||||
ShadowNode const &sourceShadowNode,
|
||||
ShadowNodeFragment const &fragment)
|
||||
: ConcreteViewShadowNode(sourceShadowNode, fragment) {
|
||||
updateTraits();
|
||||
initialize();
|
||||
}
|
||||
|
||||
static bool isColorMeaningful(SharedColor const &color) {
|
||||
static bool isColorMeaningful(SharedColor const &color) noexcept {
|
||||
if (!color) {
|
||||
return false;
|
||||
}
|
||||
@@ -36,9 +36,11 @@ static bool isColorMeaningful(SharedColor const &color) {
|
||||
return colorComponentsFromColor(color).alpha > 0;
|
||||
}
|
||||
|
||||
void ViewShadowNode::updateTraits() {
|
||||
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 ||
|
||||
@@ -54,7 +56,7 @@ void ViewShadowNode::updateTraits() {
|
||||
formsView = formsView || formsStackingContext;
|
||||
|
||||
#ifdef ANDROID
|
||||
// Force `formsStackingContext` trait for nodes which have .
|
||||
// Force `formsStackingContext` trait for nodes which have `formsView`.
|
||||
// TODO: T63560216 Investigate why/how `formsView` entangled with
|
||||
// `formsStackingContext`.
|
||||
formsStackingContext = formsStackingContext || formsView;
|
||||
|
||||
@@ -33,7 +33,7 @@ class ViewShadowNode final : public ConcreteViewShadowNode<
|
||||
ShadowNodeFragment const &fragment);
|
||||
|
||||
private:
|
||||
void updateTraits();
|
||||
void initialize() noexcept;
|
||||
};
|
||||
|
||||
} // namespace react
|
||||
|
||||
Reference in New Issue
Block a user