File tree Expand file tree Collapse file tree
packages/react-native/ReactCommon
react/renderer/components/view Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -950,12 +950,11 @@ YGValue YogaLayoutableShadowNode::yogaNodeCalcValueResolver(
950950
951951 auto & node = shadowNodeFromContext (yogaNode);
952952 auto & props = static_cast <const YogaStylableProps&>(*node.props_ );
953- auto key = static_cast <CalcExpressionPropertyID>(id);
954- if (!props.calcExpressions .contains (key)) {
953+ if (!props.calcExpressions .contains (id)) {
955954 return {};
956955 }
957-
958- auto & calc = props.calcExpressions .at (key );
956+
957+ auto & calc = props.calcExpressions .at (id );
959958 return YGValue (
960959 calc.resolve (
961960 context.referenceLength ,
Load diff Large diffs are not rendered by default.
Original file line number Diff line number Diff line change 1717#include < bitset>
1818#include < cmath>
1919#include < optional>
20+ #include < unordered_map>
2021
2122namespace facebook ::react {
2223
@@ -254,46 +255,6 @@ inline bool areBorderRadiiCircular(const BorderRadii &borderRadii)
254255 return borderRadii.isUniform () && borderRadii.topLeft .horizontal == borderRadii.topLeft .vertical ;
255256}
256257
257- enum class CalcExpressionPropertyID : uint8_t {
258- Width,
259- Height,
260- MinWidth,
261- MinHeight,
262- MaxWidth,
263- MaxHeight,
264- FlexBasis,
265- RowGap,
266- ColumnGap,
267- Gap,
268- Left,
269- Top,
270- Right,
271- Bottom,
272- Start,
273- End,
274- InsetInline,
275- InsetBlock,
276- Inset,
277- MarginLeft,
278- MarginTop,
279- MarginRight,
280- MarginBottom,
281- MarginStart,
282- MarginEnd,
283- MarginHorizontal,
284- MarginVertical,
285- MarginAll,
286- PaddingLeft,
287- PaddingTop,
288- PaddingRight,
289- PaddingBottom,
290- PaddingStart,
291- PaddingEnd,
292- PaddingHorizontal,
293- PaddingVertical,
294- PaddingAll,
295- };
296-
297- using CalcExpressions = std::unordered_map<CalcExpressionPropertyID, CSSCalc>;
258+ using CalcExpressions = std::unordered_map<uint32_t , CSSCalc>;
298259
299260} // namespace facebook::react
Original file line number Diff line number Diff line change @@ -58,7 +58,7 @@ YG_EXPORT bool YGFloatIsUndefined(float value);
5858/* *
5959 * Host-defined identifier for a dynamic style value.
6060 */
61- typedef uint8_t YGValueDynamicID;
61+ typedef uint32_t YGValueDynamicID;
6262
6363/* *
6464 * Layout context passed to YGValueDynamic for resolving dynamic values.
@@ -77,14 +77,6 @@ typedef YGValue (*YGValueDynamic)(
7777 YGValueDynamicID id,
7878 YGValueDynamicContext context);
7979
80- /* *
81- * Callback + identifier pair for internal storage.
82- */
83- struct YGValueDynamicData {
84- YGValueDynamic callback;
85- YGValueDynamicID id;
86- };
87-
8880YG_EXTERN_C_END
8981
9082// Equality operators for comparison of YGValue in C++
Original file line number Diff line number Diff line change @@ -147,6 +147,11 @@ class StyleLength {
147147 }
148148
149149 private:
150+ struct YGValueDynamicData {
151+ YGValueDynamic callback;
152+ YGValueDynamicID id;
153+ };
154+
150155 union Payload {
151156 constexpr Payload () : value{} {}
152157 constexpr explicit Payload (FloatOptional val) : value (val) {}
Original file line number Diff line number Diff line change @@ -178,6 +178,11 @@ class StyleSizeLength {
178178 }
179179
180180 private:
181+ struct YGValueDynamicData {
182+ YGValueDynamic callback;
183+ YGValueDynamicID id;
184+ };
185+
181186 union Payload {
182187 constexpr Payload () : value{} {}
183188 constexpr explicit Payload (FloatOptional val) : value (val) {}
Original file line number Diff line number Diff line change @@ -185,7 +185,7 @@ class StyleValuePool {
185185 YGValueDynamicID getDynamicCallbackID (StyleValueHandle handle) const {
186186 assert (handle.isDynamic ());
187187 assert (handle.isValueIndexed ());
188- return static_cast < uint8_t >( buffer_.get32 (handle.value () + 2 ) );
188+ return buffer_.get32 (handle.value () + 2 );
189189 }
190190
191191 static constexpr bool isIntegerPackable (float f) {
You can’t perform that action at this time.
0 commit comments