forked from facebook/react-native
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Expose box sizing getters and setters in Yoga
Differential Revision: D63135970
- Loading branch information
1 parent
eb7c439
commit 62de1cd
Showing
12 changed files
with
134 additions
and
0 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaBoxSizing.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
// @generated by enums.py | ||
|
||
package com.facebook.yoga; | ||
|
||
public enum YogaBoxSizing { | ||
CONTENT_BOX(0), | ||
BORDER_BOX(1); | ||
|
||
private final int mIntValue; | ||
|
||
YogaBoxSizing(int intValue) { | ||
mIntValue = intValue; | ||
} | ||
|
||
public int intValue() { | ||
return mIntValue; | ||
} | ||
|
||
public static YogaBoxSizing fromInt(int value) { | ||
switch (value) { | ||
case 0: return CONTENT_BOX; | ||
case 1: return BORDER_BOX; | ||
default: throw new IllegalArgumentException("Unknown enum value: " + value); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
packages/react-native/ReactCommon/yoga/yoga/enums/BoxSizing.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
// @generated by enums.py | ||
// clang-format off | ||
#pragma once | ||
|
||
#include <cstdint> | ||
#include <yoga/YGEnums.h> | ||
#include <yoga/enums/YogaEnums.h> | ||
|
||
namespace facebook::yoga { | ||
|
||
enum class BoxSizing : uint8_t { | ||
ContentBox = YGBoxSizingContentBox, | ||
BorderBox = YGBoxSizingBorderBox, | ||
}; | ||
|
||
template <> | ||
constexpr int32_t ordinalCount<BoxSizing>() { | ||
return 2; | ||
} | ||
|
||
constexpr BoxSizing scopedEnum(YGBoxSizing unscoped) { | ||
return static_cast<BoxSizing>(unscoped); | ||
} | ||
|
||
constexpr YGBoxSizing unscopedEnum(BoxSizing scoped) { | ||
return static_cast<YGBoxSizing>(scoped); | ||
} | ||
|
||
inline const char* toString(BoxSizing e) { | ||
return YGBoxSizingToString(unscopedEnum(e)); | ||
} | ||
|
||
} // namespace facebook::yoga |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters