Yoga is an open-source, cross-platform layout library that implements Flexbox. Yoga’s focus is on creating an expressive layout library, not implementing all of CSS. Therefore, there are no plans to include support for tables, floats, or similar CSS concepts. Yoga also does not support styling properties that have no impact on layout, such as color or background properties.
Yoga aims to be compatible with Flexbox according to the w3 specification. However, Yoga was not developed to strictly adhere to the specification; thus, there are aspects where Yoga differs.
Yoga has chosen to change the default values of some properties to better fit mobile layout use cases. The following CSS block describes the differences in default values from the Flexbox w3 specification:
div {
box-sizing: border-box;
position: relative;
display: flex;
flex-direction: column;
align-items: stretch;
flex-shrink: 0;
align-content: flex-start;
border-width: 0px;
margin: 0px;
padding: 0px;
min-width: 0px;
}
We believe that Right-to-Left (RTL) should be a first class citizen when it comes to layout. Therefore, Yoga implements non-standard RTL support for margin, padding, border, and position properties. This enables specifying these properties as start instead of left and end instead of right.
The goal of Yoga is to be a library which makes layout easy. Of course, implementing Flexbox, a common and well-liked system, helps meet this goal. However, there are areas where we think Yoga can evolve beyond Flexbox and provide developers with tools not included in the Flexbox w3 specification. Currently Yoga has added one such property, AspectRatio, to solve a common problem we saw in many UIs.
| Modifier and Type | Field and Description |
|---|---|
| public static final int | |
| public static final int | |
| public static final int | |
| public static final int | |
| public static final int | |
| public static final int | |
| public static final int | |
| public static final int | |
| public static final int | |
| public static final int | |
| public static final int | |
| public static final int | |
| public static final int | |
| public static final int | |
| public static final int | |
| public static final int | YGEdgeAll
YGEdge Enum values: |
| public static final int | YGEdgeBottom
YGEdge Enum values: |
| public static final int | YGEdgeEnd
YGEdge Enum values: |
| public static final int | YGEdgeHorizontal
YGEdge Enum values: |
| public static final int | YGEdgeLeft
YGEdge Enum values: |
| public static final int | YGEdgeRight
YGEdge Enum values: |
| public static final int | YGEdgeStart
YGEdge Enum values: |
| public static final int | YGEdgeTop
YGEdge Enum values: |
| public static final int | YGEdgeVertical
YGEdge Enum values: |
| public static final int | |
| public static final int | |
| public static final int | |
| public static final int | YGErrataStretchFlexBasis
YGErrata Enum values: |
| public static final int | |
| public static final int | |
| public static final int | |
| public static final int | YGFlexDirectionColumn
YGFlexDirection Enum values: |
| public static final int | YGFlexDirectionColumnReverse
YGFlexDirection Enum values: |
| public static final int | YGFlexDirectionRow
YGFlexDirection Enum values: |
| public static final int | YGFlexDirectionRowReverse
YGFlexDirection Enum values: |
| public static final int | |
| public static final int | |
| public static final int | |
| public static final int | |
| public static final int | |
| public static final int | |
| public static final int | |
| public static final int | |
| public static final int | |
| public static final int | YGLogLevelDebug
YGLogLevel Enum values: |
| public static final int | YGLogLevelError
YGLogLevel Enum values: |
| public static final int | YGLogLevelFatal
YGLogLevel Enum values: |
| public static final int | YGLogLevelInfo
YGLogLevel Enum values: |
| public static final int | YGLogLevelVerbose
YGLogLevel Enum values: |
| public static final int | YGLogLevelWarn
YGLogLevel Enum values: |
| public static final int | YGMeasureModeAtMost
YGMeasureMode Enum values: |
| public static final int | YGMeasureModeExactly
YGMeasureMode Enum values: |
| public static final int | YGMeasureModeUndefined
YGMeasureMode Enum values: |
| public static final int | |
| public static final int | |
| public static final int | |
| public static final int | |
| public static final int | |
| public static final int | YGPositionTypeAbsolute
YGPositionType Enum values: |
| public static final int | YGPositionTypeRelative
YGPositionType Enum values: |
| public static final int | YGPositionTypeStatic
YGPositionType Enum values: |
| public static final float | |
| public static final int | |
| public static final int | |
| public static final int | |
| public static final int | |
| public static final YGValue | |
| public static final YGValue | |
| public static final YGValue | |
| public static final int | |
| public static final int | |
| public static final int |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| public static native long | |
| public static native void | |
| public static native void | |
| public static native void | |
| public static native void | |
| public static native void | |
| public static native long | |
| public static native int | |
| public static native float | |
| public static native boolean | |
| public static native boolean | nYGConfigIsExperimentalFeatureEnabled(long config, int feature)
Unsafe version of: |
| public static native void | |
| public static native void | |
| public static native void | |
| public static native void | nYGConfigSetExperimentalFeatureEnabled(long config, int feature, boolean enabled)
Unsafe version of: |
| public static native void | |
| public static native void | nYGConfigSetPointScaleFactor(long config, float pixelsInPoint)
Unsafe version of: |
| public static native void | |
| public static native void | |
| public static native long | |
| public static native long | |
| public static native long | |
| public static native long | |
| public static native long | |
| public static native long | |
| public static native long | |
| public static native long | |
| public static native long | |
| public static native long | |
| public static native void | nYGNodeCalculateLayout(long node, float availableWidth, float availableHeight, int ownerDirection)
Unsafe version of: |
| public static native boolean | nYGNodeCanUseCachedMeasurement(int widthMode, float width, int heightMode, float height, int lastWidthMode, float lastWidth, int lastHeightMode, float lastHeight, float lastComputedWidth, float lastComputedHeight, float marginRow, float marginColumn, long config)
Unsafe version of: |
| public static native long | |
| public static native void | |
| public static native void | |
| public static native void | |
| public static native void | |
| public static native long | |
| public static native int | |
| public static native long | |
| public static native long | |
| public static native long | |
| public static native boolean | |
| public static native int | |
| public static native long | |
| public static native long | |
| public static native boolean | |
| public static native boolean | |
| public static native void | |
| public static native boolean | |
| public static native boolean | |
| public static native float | |
| public static native float | |
| public static native int | |
| public static native boolean | |
| public static native float | |
| public static native float | |
| public static native float | |
| public static native float | |
| public static native float | |
| public static native float | |
| public static native float | |
| public static native void | |
| public static native void | nYGNodeMarkDirtyAndPropagateToDescendants(long node)
Unsafe version of: |
| public static native long | |
| public static native void | |
| public static native void | |
| public static native void | |
| public static native void | |
| public static native void | |
| public static native void | |
| public static native void | |
| public static native void | |
| public static native void | |
| public static native void | |
| public static native void | |
| public static native void | |
| public static native void | |
| public static native int | |
| public static native int | |
| public static native int | |
| public static native float | |
| public static native float | |
| public static native int | |
| public static native int | |
| public static native float | |
| public static native void | |
| public static native int | |
| public static native float | |
| public static native float | |
| public static native int | |
| public static native float | |
| public static native void | |
| public static native int | |
| public static native void | |
| public static native void | |
| public static native void | |
| public static native void | |
| public static native void | |
| public static native int | |
| public static native void | |
| public static native void | |
| public static native int | |
| public static native void | |
| public static native void | |
| public static native void | |
| public static native void | |
| public static native void | |
| public static native void | |
| public static native void | |
| public static native void | |
| public static native void | |
| public static native void | |
| public static native void | |
| public static native void | |
| public static native void | nYGNodeStyleSetFlexDirection(long node, int flexDirection)
Unsafe version of: |
| public static native void | |
| public static native void | |
| public static native void | |
| public static native void | |
| public static native void | |
| public static native void | |
| public static native void | |
| public static native void | nYGNodeStyleSetJustifyContent(long node, int justifyContent)
Unsafe version of: |
| public static native void | |
| public static native void | |
| public static native void | nYGNodeStyleSetMarginPercent(long node, int edge, float margin)
Unsafe version of: |
| public static native void | |
| public static native void | |
| public static native void | |
| public static native void | |
| public static native void | |
| public static native void | |
| public static native void | |
| public static native void | |
| public static native void | |
| public static native void | |
| public static native void | nYGNodeStyleSetPaddingPercent(long node, int edge, float padding)
Unsafe version of: |
| public static native void | |
| public static native void | nYGNodeStyleSetPositionPercent(long node, int edge, float position)
Unsafe version of: |
| public static native void | |
| public static native void | |
| public static native void | |
| public static native void | |
| public static native void | |
| public static native long | |
| public static native long | |
| public static native long | |
| public static native long | |
| private static native void | |
| private static native void | |
| private static native void | |
| public static native long | |
| public static String | |
| public static void | |
| public static void | |
| public static void | |
| public static void | |
| public static void | |
| public static void | |
| public static void | |
| public static void | |
| public static long | |
| public static native long | |
| public static int | |
| public static native int | |
| public static float | |
| public static boolean | |
| public static boolean | |
| public static native long | |
| public static void | |
| public static void | |
| public static void | |
| public static void | |
| public static void | |
| public static void | YGConfigSetPointScaleFactor(long config, float pixelsInPoint)
Set this to number of pixels in 1 point to round calculation results. |
| public static void | |
| public static void | YGConfigSetUseWebDefaults(long config, boolean enabled)
Using the web defaults is the preferred configuration for new projects. |
| public static String | |
| public static String | |
| public static String | |
| public static String | |
| public static String | |
| public static String | |
| public static native boolean | |
| public static String | |
| public static String | |
| public static String | |
| public static String | |
| public static void | |
| public static boolean | YGNodeCanUseCachedMeasurement(int widthMode, float width, int heightMode, float height, int lastWidthMode, float lastWidth, int lastHeightMode, float lastHeight, float lastComputedWidth, float lastComputedHeight, float marginRow, float marginColumn, long config)
|
| public static long | |
| public static void | |
| public static void | |
| public static void | |
| public static void | |
| public static long | |
| public static int | |
| public static long | |
| public static long | |
| public static YGDirtiedFunc | |
| public static boolean | |
| public static int | |
| public static long | |
| public static long | |
| public static boolean | |
| public static boolean | |
| public static void | |
| public static boolean | |
| public static boolean | |
| public static float | YGNodeLayoutGetBorder(long node, int edge)
Gets the computed value for this nodes after performing layout. |
| public static float | |
| public static int | |
| public static boolean | |
| public static float | |
| public static float | |
| public static float | YGNodeLayoutGetMargin(long node, int edge)
Gets the computed value for this nodes after performing layout. |
| public static float | YGNodeLayoutGetPadding(long node, int edge)
Gets the computed value for this nodes after performing layout. |
| public static float | |
| public static float | |
| public static float | |
| public static void | |
| public static void | YGNodeMarkDirtyAndPropagateToDescendants(long node)
Marks the current node and all its descendants as dirty. |
| public static native long | |
| public static long | |
| public static void | |
| public static void | |
| public static void | |
| public static void | |
| public static void | |
| public static void | |
| public static void | |
| public static void | |
| public static void | |
| public static void | |
| public static void | |
| public static void | |
| public static void | |
| public static int | |
| public static int | |
| public static int | |
| public static float | |
| public static float | |
| public static int | |
| public static int | |
| public static float | |
| public static YGValue | |
| public static int | |
| public static float | |
| public static float | |
| public static int | |
| public static float | |
| public static YGValue | |
| public static int | |
| public static YGValue | |
| public static YGValue | |
| public static YGValue | |
| public static YGValue | |
| public static YGValue | |
| public static int | |
| public static YGValue | |
| public static YGValue | |
| public static int | |
| public static YGValue | |
| public static void | |
| public static void | |
| public static void | |
| public static void | YGNodeStyleSetAspectRatio(long node, float aspectRatio)
Aspect ratio controls the size of the undefined dimension of a node. |
| public static void | |
| public static void | |
| public static void | |
| public static void | |
| public static void | |
| public static void | |
| public static void | |
| public static void | |
| public static void | |
| public static void | |
| public static void | |
| public static void | |
| public static void | |
| public static void | |
| public static void | |
| public static void | |
| public static void | |
| public static void | |
| public static void | |
| public static void | |
| public static void | |
| public static void | |
| public static void | |
| public static void | |
| public static void | |
| public static void | |
| public static void | |
| public static void | |
| public static void | |
| public static void | |
| public static void | |
| public static void | |
| public static void | |
| public static void | |
| public static void | |
| public static void | |
| public static void | |
| public static String | |
| public static String | |
| public static String | |
| public static native float | YGRoundValueToPixelGrid(double value, double pointScaleFactor, boolean forceCeil, boolean forceFloor)
|
| public static String | |
| private static YGValue | |
| private static YGValue | |
| private static YGValue | |
| public static String |