diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 6d3decdefa91..661ace6a1118 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -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 @@ -3716,7 +3716,7 @@ SPEC CHECKSUMS: AirshipServiceExtension: 9c73369f426396d9fb9ff222d86d842fac76ba46 AppAuth: 501c04eda8a8d11f179dbe8637b7a91bb7e5d2fa AppLogs: 3bc4e9b141dbf265b9464409caaa40416a9ee0e0 - boost: 659a89341ea4ab3df8259733813b52f26d8be9a5 + boost: 7e761d76ca2ce687f7cc98e698152abd03a18f90 DoubleConversion: cb417026b2400c8f53ae97020b2be961b59470cb EXAV: 13d43af15268a3f448a6b994e91574c939f065e6 EXImageLoader: ab4fcf9240cf3636a83c00e3fc5229d692899428 @@ -3867,7 +3867,7 @@ SPEC CHECKSUMS: RNFS: 4ac0f0ea233904cb798630b3c077808c06931688 RNGestureHandler: 5d8431415d4b8518e86e289e9ad5bb9be78f6dba RNGoogleSignin: ccaa4a81582cf713eea562c5dd9dc1961a715fd0 - RNLiveMarkdown: 1c09c5813366c29885b757b4c0a5e163a89f8d55 + RNLiveMarkdown: 6e4972e95cf3b5ad0d164e08c72a6098d84e0b9d RNLocalize: d4b8af4e442d4bcca54e68fc687a2129b4d71a81 rnmapbox-maps: ef00aafe2cbef8808f2aa6168e3f86ce103058bc RNNitroSQLite: 44e596c1fb8f852f9a158eb07c647f706df13514 diff --git a/package-lock.json b/package-lock.json index b16c81e4a7f1..05590293629d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,7 +17,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", @@ -4372,9 +4372,9 @@ "link": true }, "node_modules/@expensify/react-native-live-markdown": { - "version": "0.1.289", - "resolved": "https://registry.npmjs.org/@expensify/react-native-live-markdown/-/react-native-live-markdown-0.1.289.tgz", - "integrity": "sha512-U+QHKDIEXDGvvk+zKthKncc+hrVD/9fdBBzjtV0rvA4aegU9plFkWJNkwfscVSAKzQCyiPSHaeSqa/ZSFjv68g==", + "version": "0.1.294", + "resolved": "https://registry.npmjs.org/@expensify/react-native-live-markdown/-/react-native-live-markdown-0.1.294.tgz", + "integrity": "sha512-wH2h9P8GUvHJpr+yF8hG4ZTklcb2/qHI90oQr86LKDQL8jOth54jCcho5IZ3RsCE1gi3SeeP+a/JnE65TRFO8Q==", "license": "MIT", "workspaces": [ "./example", diff --git a/package.json b/package.json index 9c71bfc51a08..81cb3c768169 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/patches/react-native/details.md b/patches/react-native/details.md index 66c1f2322689..b38a499c45aa 100644 --- a/patches/react-native/details.md +++ b/patches/react-native/details.md @@ -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) \ No newline at end of file diff --git a/patches/react-native/react-native+0.79.2+025+fix-display-contents-not-updating-nodes.patch b/patches/react-native/react-native+0.79.2+025+fix-display-contents-not-updating-nodes.patch new file mode 100644 index 000000000000..c541fac08831 --- /dev/null +++ b/patches/react-native/react-native+0.79.2+025+fix-display-contents-not-updating-nodes.patch @@ -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& 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& children) { +- children_ = children; +- } +- + // TODO: rvalue override for setChildren + + void setConfig(Config* config); + + void setDirty(bool isDirty); ++ void setChildren(const std::vector& 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;