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
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