From a16ed2e174a5a6103b0d934fe98368d67c4b4656 Mon Sep 17 00:00:00 2001 From: Ravindra Gupta <97147467+ravindraguptacapgemini@users.noreply.github.com> Date: Fri, 1 Dec 2023 12:18:57 +0530 Subject: [PATCH] Fixed issues as per required to support React Native 0.73.0-rc.4 (#454) --- .../RNCSafeAreaViewComponentDescriptor.h | 9 ++++----- .../safeareacontext/RNCSafeAreaViewShadowNode.cpp | 12 ++++++------ 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/common/cpp/react/renderer/components/safeareacontext/RNCSafeAreaViewComponentDescriptor.h b/common/cpp/react/renderer/components/safeareacontext/RNCSafeAreaViewComponentDescriptor.h index fd11385b..929c7068 100644 --- a/common/cpp/react/renderer/components/safeareacontext/RNCSafeAreaViewComponentDescriptor.h +++ b/common/cpp/react/renderer/components/safeareacontext/RNCSafeAreaViewComponentDescriptor.h @@ -12,11 +12,10 @@ namespace react { class RNCSafeAreaViewComponentDescriptor final : public ConcreteComponentDescriptor { using ConcreteComponentDescriptor::ConcreteComponentDescriptor; - void adopt(ShadowNode::Unshared const &shadowNode) const override { - auto concreteShadowNode = - std::static_pointer_cast(shadowNode); - - concreteShadowNode->adjustLayoutWithState(); + void adopt(ShadowNode& shadowNode) const override { + auto& concreteShadowNode = + static_cast(shadowNode); + concreteShadowNode.adjustLayoutWithState(); ConcreteComponentDescriptor::adopt(shadowNode); } diff --git a/common/cpp/react/renderer/components/safeareacontext/RNCSafeAreaViewShadowNode.cpp b/common/cpp/react/renderer/components/safeareacontext/RNCSafeAreaViewShadowNode.cpp index 811d9092..4f38757d 100644 --- a/common/cpp/react/renderer/components/safeareacontext/RNCSafeAreaViewShadowNode.cpp +++ b/common/cpp/react/renderer/components/safeareacontext/RNCSafeAreaViewShadowNode.cpp @@ -10,7 +10,7 @@ namespace react { extern const char RNCSafeAreaViewComponentName[] = "RNCSafeAreaView"; -inline YGValue valueFromEdges(YGStyle::Edges edges, YGEdge edge, YGEdge axis) { +inline YGValue valueFromEdges(yoga::Style::Edges edges, YGEdge edge, YGEdge axis) { YGValue edgeValue = edges[edge]; if (edgeValue.unit != YGUnitUndefined) { return edgeValue; @@ -65,24 +65,24 @@ void RNCSafeAreaViewShadowNode::adjustLayoutWithState() { valueFromEdges(props.yogaStyle.margin(), YGEdgeRight, YGEdgeHorizontal); } - top = yogaStyleValueFromFloat(getEdgeValue( + top = yoga::CompactValue::ofMaybe(getEdgeValue( edges.top, stateData.insets.top, (top.unit == YGUnitPoint ? top.value : 0))); - left = yogaStyleValueFromFloat(getEdgeValue( + left = yoga::CompactValue::ofMaybe(getEdgeValue( edges.left, stateData.insets.left, (left.unit == YGUnitPoint ? left.value : 0))); - right = yogaStyleValueFromFloat(getEdgeValue( + right = yoga::CompactValue::ofMaybe(getEdgeValue( edges.right, stateData.insets.right, (right.unit == YGUnitPoint ? right.value : 0))); - bottom = yogaStyleValueFromFloat(getEdgeValue( + bottom = yoga::CompactValue::ofMaybe(getEdgeValue( edges.bottom, stateData.insets.bottom, (bottom.unit == YGUnitPoint ? bottom.value : 0))); - YGStyle adjustedStyle = getConcreteProps().yogaStyle; + yoga::Style adjustedStyle = getConcreteProps().yogaStyle; if (props.mode == RNCSafeAreaViewMode::Padding) { adjustedStyle.padding()[YGEdgeTop] = top; adjustedStyle.padding()[YGEdgeLeft] = left;