Fix yg_positionType ordinals (#1183)

Summary:
Fixes https://github.com/facebook/yoga/issues/1179

fc88b2f774 shifted ordinals for the position enum, but only updated a limited set of code for the new values. Binding generation has since been fixed, but https://github.com/facebook/yoga/issues/1179 seems to be another case where the ordinal offsetting means that `yg_positionType` of a `YogaLayout` view does not work correctly.

Update the ordinals in accordance with the ordering in YogaPositionType which the integer value is converted to.

Using "static" (the new position type) directly gives a compilation error due to it being a reserved keyword, so I added it as "position_static" along with aliases to other properties with the same naming scheme for consistency.

Pull Request resolved: https://github.com/facebook/yoga/pull/1183

Reviewed By: lunaleaps

Differential Revision: D41741955

Pulled By: NickGerleman

fbshipit-source-id: 2b035eb38d9efea19af652e5f05c02b0be402d54
This commit is contained in:
Nick Gerleman
2022-12-06 08:39:20 -08:00
committed by Facebook GitHub Bot
parent 811b46ae63
commit 35f3335efc
2 changed files with 10 additions and 4 deletions

View File

@@ -22,4 +22,4 @@ jobs:
uses: ./.github/actions/setup-android uses: ./.github/actions/setup-android
- name: Build - name: Build
run: ./gradlew assemble${{ matrix.mode }} run: ./gradlew assemble${{ matrix.mode }} --stacktrace

View File

@@ -2,7 +2,7 @@
<!-- <!--
Copyright (c) Facebook, Inc. and its affiliates. Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree. LICENSE file in the root directory of this source tree.
--> -->
@@ -130,8 +130,14 @@
<attr name="yg_positionAll" format="dimension|string"/> <attr name="yg_positionAll" format="dimension|string"/>
<attr name="yg_positionType" format="enum"> <attr name="yg_positionType" format="enum">
<enum name="relative" value="0"/> <!-- "static" is a reserved keyword
<enum name="absolute" value="1"/> <enum name="static" value="0"/>
-->
<enum name="relative" value="1"/>
<enum name="absolute" value="2"/>
<enum name="position_static" value="0"/>
<enum name="position_relative" value="1"/>
<enum name="position_absolute" value="2"/>
</attr> </attr>
<attr name="yg_width" format="dimension|string"/> <attr name="yg_width" format="dimension|string"/>