Skip to content

Commit

Permalink
Replace YogaConstants.UNDEFINED with Float.NaN (#45141)
Browse files Browse the repository at this point in the history
Summary: Pull Request resolved: #45141

Reviewed By: javache, NickGerleman

Differential Revision: D58915391

fbshipit-source-id: 73ebee6abaced092366abdfc0ff41a66e7ff6c03
  • Loading branch information
Jingbo Yang authored and facebook-github-bot committed Jun 26, 2024
1 parent 993f9fd commit 8bd9952
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ public void setFlexBasis(Dynamic flexBasis) {
flexBasis.recycle();
}

@ReactProp(name = ViewProps.ASPECT_RATIO, defaultFloat = YogaConstants.UNDEFINED)
@ReactProp(name = ViewProps.ASPECT_RATIO, defaultFloat = Float.NaN)
public void setAspectRatio(float aspectRatio) {
setStyleAspectRatio(aspectRatio);
}
Expand Down Expand Up @@ -863,7 +863,7 @@ public void setPaddings(int index, Dynamic padding) {
ViewProps.BORDER_LEFT_WIDTH,
ViewProps.BORDER_RIGHT_WIDTH,
},
defaultFloat = YogaConstants.UNDEFINED)
defaultFloat = Float.NaN)
public void setBorderWidths(int index, float borderWidth) {
if (isVirtual()) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import com.facebook.react.uimanager.ViewProps;
import com.facebook.react.uimanager.annotations.ReactProp;
import com.facebook.react.uimanager.annotations.ReactPropGroup;
import com.facebook.yoga.YogaConstants;
import java.util.HashMap;
import java.util.Map;

Expand Down Expand Up @@ -190,9 +189,9 @@ public void setBorderWidth(ReactImageView view, float borderWidth) {
ViewProps.BORDER_BOTTOM_RIGHT_RADIUS,
ViewProps.BORDER_BOTTOM_LEFT_RADIUS
},
defaultFloat = YogaConstants.UNDEFINED)
defaultFloat = Float.NaN)
public void setBorderRadius(ReactImageView view, int index, float borderRadius) {
if (!YogaConstants.isUndefined(borderRadius)) {
if (!Float.isNaN(borderRadius)) {
borderRadius = PixelUtil.toPixelFromDIP(borderRadius);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,9 +255,9 @@ public void setBottomFillColor(ReactHorizontalScrollView view, int color) {
ViewProps.BORDER_BOTTOM_RIGHT_RADIUS,
ViewProps.BORDER_BOTTOM_LEFT_RADIUS
},
defaultFloat = YogaConstants.UNDEFINED)
defaultFloat = Float.NaN)
public void setBorderRadius(ReactHorizontalScrollView view, int index, float borderRadius) {
if (!YogaConstants.isUndefined(borderRadius)) {
if (!Float.isNaN(borderRadius)) {
borderRadius = PixelUtil.toPixelFromDIP(borderRadius);
}

Expand All @@ -281,9 +281,9 @@ public void setBorderStyle(ReactHorizontalScrollView view, @Nullable String bord
ViewProps.BORDER_TOP_WIDTH,
ViewProps.BORDER_BOTTOM_WIDTH,
},
defaultFloat = YogaConstants.UNDEFINED)
defaultFloat = Float.NaN)
public void setBorderWidth(ReactHorizontalScrollView view, int index, float width) {
if (!YogaConstants.isUndefined(width)) {
if (!Float.isNaN(width)) {
width = PixelUtil.toPixelFromDIP(width);
}
view.setBorderWidth(SPACING_TYPES[index], width);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,9 +236,9 @@ public void scrollTo(
ViewProps.BORDER_BOTTOM_RIGHT_RADIUS,
ViewProps.BORDER_BOTTOM_LEFT_RADIUS
},
defaultFloat = YogaConstants.UNDEFINED)
defaultFloat = Float.NaN)
public void setBorderRadius(ReactScrollView view, int index, float borderRadius) {
if (!YogaConstants.isUndefined(borderRadius)) {
if (!Float.isNaN(borderRadius)) {
borderRadius = PixelUtil.toPixelFromDIP(borderRadius);
}

Expand All @@ -262,9 +262,9 @@ public void setBorderStyle(ReactScrollView view, @Nullable String borderStyle) {
ViewProps.BORDER_TOP_WIDTH,
ViewProps.BORDER_BOTTOM_WIDTH,
},
defaultFloat = YogaConstants.UNDEFINED)
defaultFloat = Float.NaN)
public void setBorderWidth(ReactScrollView view, int index, float width) {
if (!YogaConstants.isUndefined(width)) {
if (!Float.isNaN(width)) {
width = PixelUtil.toPixelFromDIP(width);
}
view.setBorderWidth(SPACING_TYPES[index], width);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,9 @@ public void setAndroidHyphenationFrequency(ReactTextView view, @Nullable String
ViewProps.BORDER_BOTTOM_RIGHT_RADIUS,
ViewProps.BORDER_BOTTOM_LEFT_RADIUS
},
defaultFloat = YogaConstants.UNDEFINED)
defaultFloat = Float.NaN)
public void setBorderRadius(ReactTextView view, int index, float borderRadius) {
if (!YogaConstants.isUndefined(borderRadius)) {
if (!Float.isNaN(borderRadius)) {
borderRadius = PixelUtil.toPixelFromDIP(borderRadius);
}

Expand All @@ -163,9 +163,9 @@ public void setBorderStyle(ReactTextView view, @Nullable String borderStyle) {
ViewProps.BORDER_TOP_WIDTH,
ViewProps.BORDER_BOTTOM_WIDTH,
},
defaultFloat = YogaConstants.UNDEFINED)
defaultFloat = Float.NaN)
public void setBorderWidth(ReactTextView view, int index, float width) {
if (!YogaConstants.isUndefined(width)) {
if (!Float.isNaN(width)) {
width = PixelUtil.toPixelFromDIP(width);
}
view.setBorderWidth(SPACING_TYPES[index], width);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -957,9 +957,9 @@ public void setReturnKeyLabel(ReactEditText view, String returnKeyLabel) {
ViewProps.BORDER_BOTTOM_RIGHT_RADIUS,
ViewProps.BORDER_BOTTOM_LEFT_RADIUS
},
defaultFloat = YogaConstants.UNDEFINED)
defaultFloat = Float.NaN)
public void setBorderRadius(ReactEditText view, int index, float borderRadius) {
if (!YogaConstants.isUndefined(borderRadius)) {
if (!Float.isNaN(borderRadius)) {
borderRadius = PixelUtil.toPixelFromDIP(borderRadius);
}

Expand Down Expand Up @@ -1007,9 +1007,9 @@ public void setTextDecorationLine(ReactEditText view, @Nullable String textDecor
ViewProps.BORDER_TOP_WIDTH,
ViewProps.BORDER_BOTTOM_WIDTH,
},
defaultFloat = YogaConstants.UNDEFINED)
defaultFloat = Float.NaN)
public void setBorderWidth(ReactEditText view, int index, float width) {
if (!YogaConstants.isUndefined(width)) {
if (!Float.isNaN(width)) {
width = PixelUtil.toPixelFromDIP(width);
}
view.setBorderWidth(SPACING_TYPES[index], width);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,13 +219,13 @@ public void setNeedsOffscreenAlphaCompositing(
ViewProps.BORDER_START_WIDTH,
ViewProps.BORDER_END_WIDTH,
},
defaultFloat = YogaConstants.UNDEFINED)
defaultFloat = Float.NaN)
public void setBorderWidth(ReactViewGroup view, int index, float width) {
if (!YogaConstants.isUndefined(width) && width < 0) {
width = YogaConstants.UNDEFINED;
if (!Float.isNaN(width) && width < 0) {
width = Float.NaN;
}

if (!YogaConstants.isUndefined(width)) {
if (!Float.isNaN(width)) {
width = PixelUtil.toPixelFromDIP(width);
}

Expand Down

0 comments on commit 8bd9952

Please sign in to comment.