Remove Enumeration type

Summary:
Enumeration used to be a type containing a single property value of type string.

The InspectableEnum is a type that had an Enumeration value and possible values.

As we removed possible values from the enum value, this structure no longer serves its purpose.

Reviewed By: antonk52

Differential Revision: D41400874

fbshipit-source-id: e5c2d1e15ee9b3074ddd69f75ee9b8150d44379f
This commit is contained in:
Lorenzo Blasa
2022-11-21 05:30:18 -08:00
committed by Facebook GitHub Bot
parent 5e200dd7ec
commit 5b3e110821
9 changed files with 16 additions and 25 deletions

View File

@@ -137,8 +137,7 @@ object ComponentPropExtractor {
return InspectableArray(0, values ?: listOf())
}
override fun isPick(pick: EditorPick?): Inspectable =
InspectableValue.Enum(Enumeration(pick?.selected))
override fun isPick(pick: EditorPick): Inspectable = InspectableValue.Enum(pick.selected)
override fun isNumber(number: EditorNumber): Inspectable =
InspectableValue.Number(number.value)
@@ -146,8 +145,8 @@ object ComponentPropExtractor {
override fun isColor(number: EditorColor): Inspectable =
InspectableValue.Color(number.value.toInt().let { Color.fromColor(it) })
override fun isString(string: EditorString?): Inspectable =
InspectableValue.Text(string?.value ?: "")
override fun isString(string: EditorString): Inspectable =
InspectableValue.Text(string.value ?: "")
override fun isBool(bool: EditorBool): Inspectable = InspectableValue.Boolean(bool.value)
})

View File

@@ -324,26 +324,26 @@ object LayoutPropExtractor {
val layout = component.layoutNode ?: return props
props[AlignItemsId] = InspectableValue.Enum(Enumeration(layout.alignItems.name))
props[AlignSelfId] = InspectableValue.Enum(Enumeration(layout.alignSelf.name))
props[AlignContentId] = InspectableValue.Enum(Enumeration(layout.alignContent.name))
props[AlignItemsId] = InspectableValue.Enum(layout.alignItems.name)
props[AlignSelfId] = InspectableValue.Enum(layout.alignSelf.name)
props[AlignContentId] = InspectableValue.Enum(layout.alignContent.name)
props[AspectRatioId] = InspectableValue.Text(layout.aspectRatio.toString())
layout.background?.let { drawable -> props[BackgroundId] = fromDrawable(drawable) }
props[DirectionId] = InspectableValue.Enum(Enumeration(layout.layoutDirection.name))
props[DirectionId] = InspectableValue.Enum(layout.layoutDirection.name)
props[FlexBasisId] = InspectableValue.Text(layout.flexBasis.toString())
props[FlexDirectionId] = InspectableValue.Enum(Enumeration(layout.flexDirection.name))
props[FlexDirectionId] = InspectableValue.Enum(layout.flexDirection.name)
props[FlexGrowId] = InspectableValue.Text(layout.flexGrow.toString())
props[FlexShrinkId] = InspectableValue.Text(layout.flexShrink.toString())
layout.foreground?.let { drawable -> props[ForegroundId] = fromDrawable(drawable) }
props[JustifyContentId] = InspectableValue.Enum(Enumeration(layout.justifyContent.name))
props[JustifyContentId] = InspectableValue.Enum(layout.justifyContent.name)
props[PositionTypeId] = InspectableValue.Enum(Enumeration(layout.positionType.name))
props[PositionTypeId] = InspectableValue.Enum(layout.positionType.name)
val size: MutableMap<MetadataId, Inspectable> = mutableMapOf()
size[WidthId] = InspectableValue.Text(layout.width.toString())