Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2847,7 +2847,7 @@ PODS:
- RNGoogleSignin (10.0.1):
- GoogleSignIn (~> 7.0)
- React-Core
- RNLiveMarkdown (0.1.288):
- RNLiveMarkdown (0.1.294):
- DoubleConversion
- glog
- hermes-engine
Expand Down Expand Up @@ -3716,7 +3716,7 @@ SPEC CHECKSUMS:
AirshipServiceExtension: 9c73369f426396d9fb9ff222d86d842fac76ba46
AppAuth: 501c04eda8a8d11f179dbe8637b7a91bb7e5d2fa
AppLogs: 3bc4e9b141dbf265b9464409caaa40416a9ee0e0
boost: 659a89341ea4ab3df8259733813b52f26d8be9a5
boost: 7e761d76ca2ce687f7cc98e698152abd03a18f90
DoubleConversion: cb417026b2400c8f53ae97020b2be961b59470cb
EXAV: 13d43af15268a3f448a6b994e91574c939f065e6
EXImageLoader: ab4fcf9240cf3636a83c00e3fc5229d692899428
Expand Down Expand Up @@ -3867,7 +3867,7 @@ SPEC CHECKSUMS:
RNFS: 4ac0f0ea233904cb798630b3c077808c06931688
RNGestureHandler: 5d8431415d4b8518e86e289e9ad5bb9be78f6dba
RNGoogleSignin: ccaa4a81582cf713eea562c5dd9dc1961a715fd0
RNLiveMarkdown: 1c09c5813366c29885b757b4c0a5e163a89f8d55
RNLiveMarkdown: 6e4972e95cf3b5ad0d164e08c72a6098d84e0b9d
RNLocalize: d4b8af4e442d4bcca54e68fc687a2129b4d71a81
rnmapbox-maps: ef00aafe2cbef8808f2aa6168e3f86ce103058bc
RNNitroSQLite: 44e596c1fb8f852f9a158eb07c647f706df13514
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
"@expensify/nitro-utils": "file:./modules/ExpensifyNitroUtils",
"@expensify/react-native-background-task": "file:./modules/background-task",
"@expensify/react-native-hybrid-app": "file:./modules/hybrid-app",
"@expensify/react-native-live-markdown": "0.1.289",
"@expensify/react-native-live-markdown": "0.1.294",
"@expensify/react-native-wallet": "^0.1.5",
"@expo/metro-runtime": "^5.0.4",
"@firebase/app": "^0.10.10",
Expand Down
7 changes: 7 additions & 0 deletions patches/react-native/details.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,3 +169,10 @@
- Upstream PR/issue: 🛑
- E/App issue: 🛑
- PR Introducing Patch: https://github.com/Expensify/App/pull/60421

### [react-native+0.79.2+025+fix-display-contents-not-updating-nodes.patch](react-native+0.79.2+025+fix-display-contents-not-updating-nodes.patch)

- Reason: This patch updates Yoga to correctly update the subtrees of `display: contents` nodes so that they are in sync with their React Native counterparts.
- Upstream PR/issue: https://github.com/facebook/react-native/pull/52530
- E/App issue: https://github.com/Expensify/App/issues/65268
- PR introducing patch: [#65925](https://github.com/Expensify/App/pull/65925)
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
diff --git a/node_modules/react-native/ReactCommon/yoga/yoga/algorithm/CalculateLayout.cpp b/node_modules/react-native/ReactCommon/yoga/yoga/algorithm/CalculateLayout.cpp
index 3618474..ab5b828 100644
--- a/node_modules/react-native/ReactCommon/yoga/yoga/algorithm/CalculateLayout.cpp
+++ b/node_modules/react-native/ReactCommon/yoga/yoga/algorithm/CalculateLayout.cpp
@@ -476,16 +476,19 @@ static void zeroOutLayoutRecursively(yoga::Node* const node) {
}

static void cleanupContentsNodesRecursively(yoga::Node* const node) {
- for (auto child : node->getChildren()) {
- if (child->style().display() == Display::Contents) {
- child->getLayout() = {};
- child->setLayoutDimension(0, Dimension::Width);
- child->setLayoutDimension(0, Dimension::Height);
- child->setHasNewLayout(true);
- child->setDirty(false);
- child->cloneChildrenIfNeeded();
-
- cleanupContentsNodesRecursively(child);
+ if (node->hasContentsChildren()) [[unlikely]] {
+ node->cloneContentsChildrenIfNeeded();
+ for (auto child : node->getChildren()) {
+ if (child->style().display() == Display::Contents) {
+ child->getLayout() = {};
+ child->setLayoutDimension(0, Dimension::Width);
+ child->setLayoutDimension(0, Dimension::Height);
+ child->setHasNewLayout(true);
+ child->setDirty(false);
+ child->cloneChildrenIfNeeded();
+
+ cleanupContentsNodesRecursively(child);
+ }
}
}
}
diff --git a/node_modules/react-native/ReactCommon/yoga/yoga/node/Node.cpp b/node_modules/react-native/ReactCommon/yoga/yoga/node/Node.cpp
index dce42fb..f1bc5e8 100644
--- a/node_modules/react-native/ReactCommon/yoga/yoga/node/Node.cpp
+++ b/node_modules/react-native/ReactCommon/yoga/yoga/node/Node.cpp
@@ -181,6 +181,17 @@ void Node::setDirty(bool isDirty) {
}
}

+void Node::setChildren(const std::vector<Node*>& children) {
+ children_ = children;
+
+ contentsChildrenCount_ = 0;
+ for (const auto& child : children) {
+ if (child->style().display() == Display::Contents) {
+ contentsChildrenCount_++;
+ }
+ }
+}
+
bool Node::removeChild(Node* child) {
auto p = std::find(children_.begin(), children_.end(), child);
if (p != children_.end()) {
@@ -379,6 +390,23 @@ void Node::cloneChildrenIfNeeded() {
if (child->getOwner() != this) {
child = resolveRef(config_->cloneNode(child, this, i));
child->setOwner(this);
+
+ if (child->hasContentsChildren()) [[unlikely]] {
+ child->cloneContentsChildrenIfNeeded();
+ }
+ }
+ i += 1;
+ }
+}
+
+void Node::cloneContentsChildrenIfNeeded() {
+ size_t i = 0;
+ for (Node*& child : children_) {
+ if (child->style().display() == Display::Contents &&
+ child->getOwner() != this) {
+ child = resolveRef(config_->cloneNode(child, this, i));
+ child->setOwner(this);
+ child->cloneChildrenIfNeeded();
}
i += 1;
}
diff --git a/node_modules/react-native/ReactCommon/yoga/yoga/node/Node.h b/node_modules/react-native/ReactCommon/yoga/yoga/node/Node.h
index 5ae7d43..3454d54 100644
--- a/node_modules/react-native/ReactCommon/yoga/yoga/node/Node.h
+++ b/node_modules/react-native/ReactCommon/yoga/yoga/node/Node.h
@@ -96,6 +96,10 @@ class YG_EXPORT Node : public ::YGNode {
return config_->hasErrata(errata);
}

+ bool hasContentsChildren() const {
+ return contentsChildrenCount_ != 0;
+ }
+
YGDirtiedFunc getDirtiedFunc() const {
return dirtiedFunc_;
}
@@ -244,15 +248,12 @@ class YG_EXPORT Node : public ::YGNode {
owner_ = owner;
}

- void setChildren(const std::vector<Node*>& children) {
- children_ = children;
- }
-
// TODO: rvalue override for setChildren

void setConfig(Config* config);

void setDirty(bool isDirty);
+ void setChildren(const std::vector<Node*>& children);
void setLayoutLastOwnerDirection(Direction direction);
void setLayoutComputedFlexBasis(FloatOptional computedFlexBasis);
void setLayoutComputedFlexBasisGeneration(
@@ -286,6 +287,7 @@ class YG_EXPORT Node : public ::YGNode {
void removeChild(size_t index);

void cloneChildrenIfNeeded();
+ void cloneContentsChildrenIfNeeded();
void markDirtyAndPropagate();
float resolveFlexGrow() const;
float resolveFlexShrink() const;
Loading