Update c# docs to use object initializer
Summary: Updates the C# docs to use the object initializer instead of `Create` which doesn't exist anymore. Fixes facebook/yoga#550. Closes https://github.com/facebook/yoga/pull/601 Reviewed By: emilsjolander Differential Revision: D5427217 Pulled By: splhack fbshipit-source-id: 9a2f036335e5ab475d5c1ee8308701ccb5a3b4e4
This commit is contained in:
committed by
Facebook Github Bot
parent
79e294c927
commit
570a193b7e
@@ -8,36 +8,11 @@ permalink: /docs/api/csharp/
|
|||||||
|
|
||||||
### Lifecycle
|
### Lifecycle
|
||||||
|
|
||||||
Create a `YogaNode` via its default constructor or the static `Create()` builder method and use `Reset` if you want to pool and re-use nodes. The native memory of a `YogaNode` will automatically be freed when the node is garbage collected.
|
Create a `YogaNode` via its default constructor and use `Reset` if you want to pool and re-use nodes. The native memory of a `YogaNode` will automatically be freed when the node is garbage collected.
|
||||||
|
|
||||||
```csharp
|
```csharp
|
||||||
YogaNode();
|
YogaNode();
|
||||||
void Reset();
|
void Reset();
|
||||||
|
|
||||||
static YogaNode Create(
|
|
||||||
YogaDirection? styleDirection = null,
|
|
||||||
YogaFlexDirection? flexDirection = null,
|
|
||||||
YogaJustify? justifyContent = null,
|
|
||||||
YogaAlign? alignContent = null,
|
|
||||||
YogaAlign? alignItems = null,
|
|
||||||
YogaAlign? alignSelf = null,
|
|
||||||
YogaPositionType? positionType = null,
|
|
||||||
YogaWrap? wrap = null,
|
|
||||||
YogaOverflow? overflow = null,
|
|
||||||
float? flex = null,
|
|
||||||
float? flexGrow = null,
|
|
||||||
float? flexShrink = null,
|
|
||||||
float? flexBasis = null,
|
|
||||||
Spacing position = null,
|
|
||||||
Spacing margin = null,
|
|
||||||
Spacing padding = null,
|
|
||||||
Spacing border = null,
|
|
||||||
float? Width = null,
|
|
||||||
float? Height = null,
|
|
||||||
float? MaxWidth = null,
|
|
||||||
float? MaxHeight = null,
|
|
||||||
float? MinWidth = null,
|
|
||||||
float? MinHeight = null);
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Children
|
### Children
|
||||||
@@ -95,6 +70,9 @@ enum YogaAlign
|
|||||||
Center,
|
Center,
|
||||||
FlexEnd,
|
FlexEnd,
|
||||||
Stretch,
|
Stretch,
|
||||||
|
Baseline,
|
||||||
|
SpaceBetween,
|
||||||
|
SpaceAround
|
||||||
}
|
}
|
||||||
|
|
||||||
YogaAlign AlignItems {get, set};
|
YogaAlign AlignItems {get, set};
|
||||||
@@ -113,6 +91,7 @@ enum YogaWrap
|
|||||||
{
|
{
|
||||||
NoWrap,
|
NoWrap,
|
||||||
Wrap,
|
Wrap,
|
||||||
|
WrapReverse
|
||||||
}
|
}
|
||||||
|
|
||||||
YogaWrap Wrap {get, set};
|
YogaWrap Wrap {get, set};
|
||||||
@@ -197,18 +176,13 @@ enum YogaMeasureMode
|
|||||||
AtMost,
|
AtMost,
|
||||||
}
|
}
|
||||||
|
|
||||||
public delegate long MeasureFunction(
|
public delegate YogaSize MeasureFunction(
|
||||||
YogaNode node,
|
YogaNode node,
|
||||||
float width,
|
float width,
|
||||||
YogaMeasureMode widthMode,
|
YogaMeasureMode widthMode,
|
||||||
float height,
|
float height,
|
||||||
YogaMeasureMode heightMode);
|
YogaMeasureMode heightMode);
|
||||||
|
|
||||||
class MeasureOutput
|
|
||||||
{
|
|
||||||
public static long Make(int width, int height);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetMeasureFunction(MeasureFunction measureFunction);
|
void SetMeasureFunction(MeasureFunction measureFunction);
|
||||||
bool IsMeasureDefined();
|
bool IsMeasureDefined();
|
||||||
|
|
||||||
|
@@ -124,18 +124,20 @@ root.addChildAt(image, 1);
|
|||||||
<div class="blockContent">
|
<div class="blockContent">
|
||||||
<div markdown="1" style="width: 700px; max-width: 100%;">
|
<div markdown="1" style="width: 700px; max-width: 100%;">
|
||||||
```csharp
|
```csharp
|
||||||
YogaNode root = YogaNode.Create(
|
YogaNode root = new YogaNode {
|
||||||
width: 500,
|
Width = 500,
|
||||||
height: 300,
|
Height = 300
|
||||||
);
|
};
|
||||||
|
|
||||||
YogaNode image = YogaNode.Create(flexGrow: 1);
|
YogaNode image = new YogaNode {
|
||||||
|
FlexGrow = 1
|
||||||
|
};
|
||||||
|
|
||||||
YogaNode text = YogaNode.Create(
|
YogaNode text = new YogaNode {
|
||||||
width: 300,
|
Width = 300,
|
||||||
height: 25,
|
Height = 25,
|
||||||
margin: new Spacing(left: 20, top: 20, right: 20, bottom: 20),
|
Margin = 20
|
||||||
);
|
};
|
||||||
|
|
||||||
root.Insert(image, 0);
|
root.Insert(image, 0);
|
||||||
root.Insert(text, 1);
|
root.Insert(text, 1);
|
||||||
|
Reference in New Issue
Block a user