Skip to content

Commit

Permalink
Fixed issues as per required to support React Native 0.73.0-rc.4 (#454)
Browse files Browse the repository at this point in the history
  • Loading branch information
ravindraguptacapgemini committed Dec 1, 2023
1 parent c391781 commit a16ed2e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@ namespace react {
class RNCSafeAreaViewComponentDescriptor final
: public ConcreteComponentDescriptor<RNCSafeAreaViewShadowNode> {
using ConcreteComponentDescriptor::ConcreteComponentDescriptor;
void adopt(ShadowNode::Unshared const &shadowNode) const override {
auto concreteShadowNode =
std::static_pointer_cast<RNCSafeAreaViewShadowNode>(shadowNode);

concreteShadowNode->adjustLayoutWithState();
void adopt(ShadowNode& shadowNode) const override {
auto& concreteShadowNode =
static_cast<RNCSafeAreaViewShadowNode&>(shadowNode);
concreteShadowNode.adjustLayoutWithState();

ConcreteComponentDescriptor::adopt(shadowNode);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -65,24 +65,24 @@ void RNCSafeAreaViewShadowNode::adjustLayoutWithState() {
valueFromEdges(props.yogaStyle.margin(), YGEdgeRight, YGEdgeHorizontal);
}

top = yogaStyleValueFromFloat(getEdgeValue(
top = yoga::CompactValue::ofMaybe<YGUnitPoint>(getEdgeValue(
edges.top,
stateData.insets.top,
(top.unit == YGUnitPoint ? top.value : 0)));
left = yogaStyleValueFromFloat(getEdgeValue(
left = yoga::CompactValue::ofMaybe<YGUnitPoint>(getEdgeValue(
edges.left,
stateData.insets.left,
(left.unit == YGUnitPoint ? left.value : 0)));
right = yogaStyleValueFromFloat(getEdgeValue(
right = yoga::CompactValue::ofMaybe<YGUnitPoint>(getEdgeValue(
edges.right,
stateData.insets.right,
(right.unit == YGUnitPoint ? right.value : 0)));
bottom = yogaStyleValueFromFloat(getEdgeValue(
bottom = yoga::CompactValue::ofMaybe<YGUnitPoint>(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;
Expand Down

0 comments on commit a16ed2e

Please sign in to comment.