From 211534b481e2df9eda690f9090ff3a47497269e1 Mon Sep 17 00:00:00 2001 From: Joe Vilches Date: Thu, 3 Oct 2024 12:21:16 -0700 Subject: [PATCH] Add default test for box sizing (#46800) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/46800 X-link: https://github.com/facebook/yoga/pull/1716 Had a mini heart attack thinking I set the default to content box. Wrote this to double check and it passed. Might as well check it in Technically the default to BoxSizing.h is ContentBox, but in the style we override that. Regardless I switched that around so border box was the default. Changelog: [Internal] Reviewed By: NickGerleman Differential Revision: D63802722 fbshipit-source-id: 49ed29657c964bc12a2bf70988061ab4599267ec --- .../src/main/java/com/facebook/yoga/YogaBoxSizing.java | 8 ++++---- packages/react-native/ReactCommon/yoga/yoga/YGEnums.cpp | 4 ++-- packages/react-native/ReactCommon/yoga/yoga/YGEnums.h | 4 ++-- .../react-native/ReactCommon/yoga/yoga/enums/BoxSizing.h | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaBoxSizing.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaBoxSizing.java index a8c08f65436..fcd25f55ddc 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaBoxSizing.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaBoxSizing.java @@ -10,8 +10,8 @@ package com.facebook.yoga; public enum YogaBoxSizing { - CONTENT_BOX(0), - BORDER_BOX(1); + BORDER_BOX(0), + CONTENT_BOX(1); private final int mIntValue; @@ -25,8 +25,8 @@ public enum YogaBoxSizing { public static YogaBoxSizing fromInt(int value) { switch (value) { - case 0: return CONTENT_BOX; - case 1: return BORDER_BOX; + case 0: return BORDER_BOX; + case 1: return CONTENT_BOX; default: throw new IllegalArgumentException("Unknown enum value: " + value); } } diff --git a/packages/react-native/ReactCommon/yoga/yoga/YGEnums.cpp b/packages/react-native/ReactCommon/yoga/yoga/YGEnums.cpp index 1d4975b138a..c0a72918d8c 100644 --- a/packages/react-native/ReactCommon/yoga/yoga/YGEnums.cpp +++ b/packages/react-native/ReactCommon/yoga/yoga/YGEnums.cpp @@ -35,10 +35,10 @@ const char* YGAlignToString(const YGAlign value) { const char* YGBoxSizingToString(const YGBoxSizing value) { switch (value) { - case YGBoxSizingContentBox: - return "content-box"; case YGBoxSizingBorderBox: return "border-box"; + case YGBoxSizingContentBox: + return "content-box"; } return "unknown"; } diff --git a/packages/react-native/ReactCommon/yoga/yoga/YGEnums.h b/packages/react-native/ReactCommon/yoga/yoga/YGEnums.h index 8a2161a9070..83c368a601b 100644 --- a/packages/react-native/ReactCommon/yoga/yoga/YGEnums.h +++ b/packages/react-native/ReactCommon/yoga/yoga/YGEnums.h @@ -26,8 +26,8 @@ YG_ENUM_DECL( YG_ENUM_DECL( YGBoxSizing, - YGBoxSizingContentBox, - YGBoxSizingBorderBox) + YGBoxSizingBorderBox, + YGBoxSizingContentBox) YG_ENUM_DECL( YGDimension, diff --git a/packages/react-native/ReactCommon/yoga/yoga/enums/BoxSizing.h b/packages/react-native/ReactCommon/yoga/yoga/enums/BoxSizing.h index 1b6b9a7cd22..eb18b99a0d8 100644 --- a/packages/react-native/ReactCommon/yoga/yoga/enums/BoxSizing.h +++ b/packages/react-native/ReactCommon/yoga/yoga/enums/BoxSizing.h @@ -16,8 +16,8 @@ namespace facebook::yoga { enum class BoxSizing : uint8_t { - ContentBox = YGBoxSizingContentBox, BorderBox = YGBoxSizingBorderBox, + ContentBox = YGBoxSizingContentBox, }; template <>