Skip to content

Commit

Permalink
Remove FloatOptional related TODOs
Browse files Browse the repository at this point in the history
Summary:
These were added quite a while ago, and the proprosed change doesn't really make sense to pursue, since FloatOptional is a C++ wrapper around a Float, and the public API is entirely C.

bypass-github-export-checks

Reviewed By: rshest

Differential Revision: D49476343

fbshipit-source-id: f83cc99adda75fc0dba96e063cca92510c3d2ef0
  • Loading branch information
NickGerleman authored and ShevO27 committed Sep 26, 2023
1 parent 33eb2d4 commit 88bc0ac
Showing 1 changed file with 0 additions and 12 deletions.
12 changes: 0 additions & 12 deletions packages/react-native/ReactCommon/yoga/yoga/Yoga.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -523,26 +523,22 @@ YGDisplay YGNodeStyleGetDisplay(const YGNodeConstRef node) {
return unscopedEnum(resolveRef(node)->getStyle().display());
}

// TODO(T26792433): Change the API to accept FloatOptional.
void YGNodeStyleSetFlex(const YGNodeRef node, const float flex) {
updateStyle<MSVC_HINT(flex)>(node, &Style::flex, FloatOptional{flex});
}

// TODO(T26792433): Change the API to accept FloatOptional.
float YGNodeStyleGetFlex(const YGNodeConstRef nodeRef) {
const auto node = resolveRef(nodeRef);
return node->getStyle().flex().isUndefined()
? YGUndefined
: node->getStyle().flex().unwrap();
}

// TODO(T26792433): Change the API to accept FloatOptional.
void YGNodeStyleSetFlexGrow(const YGNodeRef node, const float flexGrow) {
updateStyle<MSVC_HINT(flexGrow)>(
node, &Style::flexGrow, FloatOptional{flexGrow});
}

// TODO(T26792433): Change the API to accept FloatOptional.
void YGNodeStyleSetFlexShrink(const YGNodeRef node, const float flexShrink) {
updateStyle<MSVC_HINT(flexShrink)>(
node, &Style::flexShrink, FloatOptional{flexShrink});
Expand All @@ -551,7 +547,6 @@ void YGNodeStyleSetFlexShrink(const YGNodeRef node, const float flexShrink) {
YGValue YGNodeStyleGetFlexBasis(const YGNodeConstRef node) {
YGValue flexBasis = resolveRef(node)->getStyle().flexBasis();
if (flexBasis.unit == YGUnitUndefined || flexBasis.unit == YGUnitAuto) {
// TODO(T26792433): Get rid off the use of YGUndefined at client side
flexBasis.value = YGUndefined;
}
return flexBasis;
Expand Down Expand Up @@ -618,7 +613,6 @@ YGValue YGNodeStyleGetPadding(YGNodeConstRef node, YGEdge edge) {
return resolveRef(node)->getStyle().padding()[edge];
}

// TODO(T26792433): Change the API to accept FloatOptional.
void YGNodeStyleSetBorder(
const YGNodeRef node,
const YGEdge edge,
Expand All @@ -630,8 +624,6 @@ void YGNodeStyleSetBorder(
float YGNodeStyleGetBorder(const YGNodeConstRef node, const YGEdge edge) {
auto border = resolveRef(node)->getStyle().border()[edge];
if (border.isUndefined() || border.isAuto()) {
// TODO(T26792433): Rather than returning YGUndefined, change the api to
// return FloatOptional.
return YGUndefined;
}

Expand All @@ -649,8 +641,6 @@ void YGNodeStyleSetGap(
float YGNodeStyleGetGap(const YGNodeConstRef node, const YGGutter gutter) {
auto gapLength = resolveRef(node)->getStyle().gap()[gutter];
if (gapLength.isUndefined() || gapLength.isAuto()) {
// TODO(T26792433): Rather than returning YGUndefined, change the api to
// return FloatOptional.
return YGUndefined;
}

Expand All @@ -659,13 +649,11 @@ float YGNodeStyleGetGap(const YGNodeConstRef node, const YGGutter gutter) {

// Yoga specific properties, not compatible with flexbox specification

// TODO(T26792433): Change the API to accept FloatOptional.
float YGNodeStyleGetAspectRatio(const YGNodeConstRef node) {
const FloatOptional op = resolveRef(node)->getStyle().aspectRatio();
return op.isUndefined() ? YGUndefined : op.unwrap();
}

// TODO(T26792433): Change the API to accept FloatOptional.
void YGNodeStyleSetAspectRatio(const YGNodeRef node, const float aspectRatio) {
updateStyle<MSVC_HINT(aspectRatio)>(
node, &Style::aspectRatio, FloatOptional{aspectRatio});
Expand Down

0 comments on commit 88bc0ac

Please sign in to comment.