2023-05-09 22:21:01 -07:00
|
|
|
/**
|
|
|
|
* 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
|
|
|
|
|
|
|
|
export enum Align {
|
|
|
|
Auto = 0,
|
|
|
|
FlexStart = 1,
|
|
|
|
Center = 2,
|
|
|
|
FlexEnd = 3,
|
|
|
|
Stretch = 4,
|
|
|
|
Baseline = 5,
|
|
|
|
SpaceBetween = 6,
|
|
|
|
SpaceAround = 7,
|
2023-10-17 20:59:51 -07:00
|
|
|
SpaceEvenly = 8,
|
2023-05-09 22:21:01 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
export enum Dimension {
|
|
|
|
Width = 0,
|
|
|
|
Height = 1,
|
|
|
|
}
|
|
|
|
|
|
|
|
export enum Direction {
|
|
|
|
Inherit = 0,
|
|
|
|
LTR = 1,
|
|
|
|
RTL = 2,
|
|
|
|
}
|
|
|
|
|
|
|
|
export enum Display {
|
|
|
|
Flex = 0,
|
|
|
|
None = 1,
|
|
|
|
}
|
|
|
|
|
|
|
|
export enum Edge {
|
|
|
|
Left = 0,
|
|
|
|
Top = 1,
|
|
|
|
Right = 2,
|
|
|
|
Bottom = 3,
|
|
|
|
Start = 4,
|
|
|
|
End = 5,
|
|
|
|
Horizontal = 6,
|
|
|
|
Vertical = 7,
|
|
|
|
All = 8,
|
|
|
|
}
|
|
|
|
|
|
|
|
export enum Errata {
|
|
|
|
None = 0,
|
|
|
|
StretchFlexBasis = 1,
|
Remove row-reverse errata (#1547)
Summary:
Pull Request resolved: https://github.com/facebook/yoga/pull/1547
X-link: https://github.com/facebook/react-native/pull/42251
Yoga has an odd behavior, where `start`/`end` edges under row-reverse are relative to flex-direction, instead of writing direction.
While Yoga doesn't actually document what this behavior is supposed to be, it goes against CK documentation, historic RN documentation, and the behavior valid on the web. It is also applied inconsistently (e.g. sometimes only on container, sometimes on child). It really is a bug, instead of an intended behavior.
We changed the default behavior for Yoga, but left the existing one behind an errata (so existing fbsource users got old behavior). We have previously seen this behavior show up in product code, including CK when running on FlexLayout.
`row-reverse` is surprisingly uncommon though:
1. Litho has <40 usages
2. RN has ~40 usages in `RKJSModules`,~30 in `arvr/js`, ~6 in `xplat/archon`
3. CK has ~80 usages
4. NT has ~40 usages
There are few enough, mostly simple components, that we can inspect through each of them, looking for signs they will hit the issue (at the potential chance of missing some).
CK accounts for 10/14 usages that I could tell would trigger the issue, since it only exposes start/end edge, and not left/right. It might make sense to make it preserve behavior instead, to reduce risk a bit.
FlexLayout is now separately powering Bloks, which wasn't surveyed, so I didn't touch CK behavior under Bloks.
There could also be other usages in other frameworks/bespoke usages, and this has implications for OSS users. But based on our own usage, of many, many components, this seems rare.
Changelog:
[General][Breaking] - Make `start/end` in styles always refer to writing direction
Reviewed By: pentiumao, joevilches
Differential Revision: D52698130
fbshipit-source-id: 2a9ac47e177469f30dc988d916b6c0ad95d53461
2024-01-12 13:49:53 -08:00
|
|
|
PositionStaticBehavesLikeRelative = 2,
|
|
|
|
AbsolutePositioning = 4,
|
2023-05-09 22:21:01 -07:00
|
|
|
All = 2147483647,
|
|
|
|
Classic = 2147483646,
|
|
|
|
}
|
|
|
|
|
|
|
|
export enum ExperimentalFeature {
|
|
|
|
WebFlexBasis = 0,
|
|
|
|
AbsolutePercentageAgainstPaddingEdge = 1,
|
|
|
|
}
|
|
|
|
|
|
|
|
export enum FlexDirection {
|
|
|
|
Column = 0,
|
|
|
|
ColumnReverse = 1,
|
|
|
|
Row = 2,
|
|
|
|
RowReverse = 3,
|
|
|
|
}
|
|
|
|
|
|
|
|
export enum Gutter {
|
|
|
|
Column = 0,
|
|
|
|
Row = 1,
|
|
|
|
All = 2,
|
|
|
|
}
|
|
|
|
|
|
|
|
export enum Justify {
|
|
|
|
FlexStart = 0,
|
|
|
|
Center = 1,
|
|
|
|
FlexEnd = 2,
|
|
|
|
SpaceBetween = 3,
|
|
|
|
SpaceAround = 4,
|
|
|
|
SpaceEvenly = 5,
|
|
|
|
}
|
|
|
|
|
|
|
|
export enum LogLevel {
|
|
|
|
Error = 0,
|
|
|
|
Warn = 1,
|
|
|
|
Info = 2,
|
|
|
|
Debug = 3,
|
|
|
|
Verbose = 4,
|
|
|
|
Fatal = 5,
|
|
|
|
}
|
|
|
|
|
|
|
|
export enum MeasureMode {
|
|
|
|
Undefined = 0,
|
|
|
|
Exactly = 1,
|
|
|
|
AtMost = 2,
|
|
|
|
}
|
|
|
|
|
|
|
|
export enum NodeType {
|
|
|
|
Default = 0,
|
|
|
|
Text = 1,
|
|
|
|
}
|
|
|
|
|
|
|
|
export enum Overflow {
|
|
|
|
Visible = 0,
|
|
|
|
Hidden = 1,
|
|
|
|
Scroll = 2,
|
|
|
|
}
|
|
|
|
|
|
|
|
export enum PositionType {
|
|
|
|
Static = 0,
|
|
|
|
Relative = 1,
|
|
|
|
Absolute = 2,
|
|
|
|
}
|
|
|
|
|
|
|
|
export enum PrintOptions {
|
|
|
|
Layout = 1,
|
|
|
|
Style = 2,
|
|
|
|
Children = 4,
|
|
|
|
}
|
|
|
|
|
|
|
|
export enum Unit {
|
|
|
|
Undefined = 0,
|
|
|
|
Point = 1,
|
|
|
|
Percent = 2,
|
|
|
|
Auto = 3,
|
|
|
|
}
|
|
|
|
|
|
|
|
export enum Wrap {
|
|
|
|
NoWrap = 0,
|
|
|
|
Wrap = 1,
|
|
|
|
WrapReverse = 2,
|
|
|
|
}
|
|
|
|
|
|
|
|
const constants = {
|
|
|
|
ALIGN_AUTO: Align.Auto,
|
|
|
|
ALIGN_FLEX_START: Align.FlexStart,
|
|
|
|
ALIGN_CENTER: Align.Center,
|
|
|
|
ALIGN_FLEX_END: Align.FlexEnd,
|
|
|
|
ALIGN_STRETCH: Align.Stretch,
|
|
|
|
ALIGN_BASELINE: Align.Baseline,
|
|
|
|
ALIGN_SPACE_BETWEEN: Align.SpaceBetween,
|
|
|
|
ALIGN_SPACE_AROUND: Align.SpaceAround,
|
2023-10-17 20:59:51 -07:00
|
|
|
ALIGN_SPACE_EVENLY: Align.SpaceEvenly,
|
2023-05-09 22:21:01 -07:00
|
|
|
DIMENSION_WIDTH: Dimension.Width,
|
|
|
|
DIMENSION_HEIGHT: Dimension.Height,
|
|
|
|
DIRECTION_INHERIT: Direction.Inherit,
|
|
|
|
DIRECTION_LTR: Direction.LTR,
|
|
|
|
DIRECTION_RTL: Direction.RTL,
|
|
|
|
DISPLAY_FLEX: Display.Flex,
|
|
|
|
DISPLAY_NONE: Display.None,
|
|
|
|
EDGE_LEFT: Edge.Left,
|
|
|
|
EDGE_TOP: Edge.Top,
|
|
|
|
EDGE_RIGHT: Edge.Right,
|
|
|
|
EDGE_BOTTOM: Edge.Bottom,
|
|
|
|
EDGE_START: Edge.Start,
|
|
|
|
EDGE_END: Edge.End,
|
|
|
|
EDGE_HORIZONTAL: Edge.Horizontal,
|
|
|
|
EDGE_VERTICAL: Edge.Vertical,
|
|
|
|
EDGE_ALL: Edge.All,
|
|
|
|
ERRATA_NONE: Errata.None,
|
|
|
|
ERRATA_STRETCH_FLEX_BASIS: Errata.StretchFlexBasis,
|
2023-10-23 18:20:24 -07:00
|
|
|
ERRATA_POSITION_STATIC_BEHAVES_LIKE_RELATIVE: Errata.PositionStaticBehavesLikeRelative,
|
2023-12-07 21:25:45 -08:00
|
|
|
ERRATA_ABSOLUTE_POSITIONING: Errata.AbsolutePositioning,
|
2023-05-09 22:21:01 -07:00
|
|
|
ERRATA_ALL: Errata.All,
|
|
|
|
ERRATA_CLASSIC: Errata.Classic,
|
|
|
|
EXPERIMENTAL_FEATURE_WEB_FLEX_BASIS: ExperimentalFeature.WebFlexBasis,
|
|
|
|
EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE: ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge,
|
|
|
|
FLEX_DIRECTION_COLUMN: FlexDirection.Column,
|
|
|
|
FLEX_DIRECTION_COLUMN_REVERSE: FlexDirection.ColumnReverse,
|
|
|
|
FLEX_DIRECTION_ROW: FlexDirection.Row,
|
|
|
|
FLEX_DIRECTION_ROW_REVERSE: FlexDirection.RowReverse,
|
|
|
|
GUTTER_COLUMN: Gutter.Column,
|
|
|
|
GUTTER_ROW: Gutter.Row,
|
|
|
|
GUTTER_ALL: Gutter.All,
|
|
|
|
JUSTIFY_FLEX_START: Justify.FlexStart,
|
|
|
|
JUSTIFY_CENTER: Justify.Center,
|
|
|
|
JUSTIFY_FLEX_END: Justify.FlexEnd,
|
|
|
|
JUSTIFY_SPACE_BETWEEN: Justify.SpaceBetween,
|
|
|
|
JUSTIFY_SPACE_AROUND: Justify.SpaceAround,
|
|
|
|
JUSTIFY_SPACE_EVENLY: Justify.SpaceEvenly,
|
|
|
|
LOG_LEVEL_ERROR: LogLevel.Error,
|
|
|
|
LOG_LEVEL_WARN: LogLevel.Warn,
|
|
|
|
LOG_LEVEL_INFO: LogLevel.Info,
|
|
|
|
LOG_LEVEL_DEBUG: LogLevel.Debug,
|
|
|
|
LOG_LEVEL_VERBOSE: LogLevel.Verbose,
|
|
|
|
LOG_LEVEL_FATAL: LogLevel.Fatal,
|
|
|
|
MEASURE_MODE_UNDEFINED: MeasureMode.Undefined,
|
|
|
|
MEASURE_MODE_EXACTLY: MeasureMode.Exactly,
|
|
|
|
MEASURE_MODE_AT_MOST: MeasureMode.AtMost,
|
|
|
|
NODE_TYPE_DEFAULT: NodeType.Default,
|
|
|
|
NODE_TYPE_TEXT: NodeType.Text,
|
|
|
|
OVERFLOW_VISIBLE: Overflow.Visible,
|
|
|
|
OVERFLOW_HIDDEN: Overflow.Hidden,
|
|
|
|
OVERFLOW_SCROLL: Overflow.Scroll,
|
|
|
|
POSITION_TYPE_STATIC: PositionType.Static,
|
|
|
|
POSITION_TYPE_RELATIVE: PositionType.Relative,
|
|
|
|
POSITION_TYPE_ABSOLUTE: PositionType.Absolute,
|
|
|
|
PRINT_OPTIONS_LAYOUT: PrintOptions.Layout,
|
|
|
|
PRINT_OPTIONS_STYLE: PrintOptions.Style,
|
|
|
|
PRINT_OPTIONS_CHILDREN: PrintOptions.Children,
|
|
|
|
UNIT_UNDEFINED: Unit.Undefined,
|
|
|
|
UNIT_POINT: Unit.Point,
|
|
|
|
UNIT_PERCENT: Unit.Percent,
|
|
|
|
UNIT_AUTO: Unit.Auto,
|
|
|
|
WRAP_NO_WRAP: Wrap.NoWrap,
|
|
|
|
WRAP_WRAP: Wrap.Wrap,
|
|
|
|
WRAP_WRAP_REVERSE: Wrap.WrapReverse,
|
|
|
|
}
|
|
|
|
export default constants
|