Add min/max in YogaRecord

Summary: Add min/max in YogaRecord

Reviewed By: emilsjolander

Differential Revision: D6998533

fbshipit-source-id: 4613c99bd3a4cb3b8fbe577909157b25f3bef9c7
This commit is contained in:
Pritesh Nandgaonkar
2018-02-15 06:12:14 -08:00
committed by Facebook Github Bot
parent 1b66b5d941
commit 69242938f7
2 changed files with 14 additions and 2 deletions

View File

@@ -21,7 +21,7 @@ import type {
Yoga$JustifyContent,
Yoga$FlexDirection,
Yoga$FlexWrap,
Yoga$PositionType,
Yoga$YogaPositionType,
} from 'yoga-layout';
export type LayoutRecordT = RecordOf<{
@@ -32,7 +32,7 @@ export type LayoutRecordT = RecordOf<{
border: PositionRecordT,
margin: PositionRecordT,
position: PositionRecordT,
positionType: Yoga$PositionType,
positionType: Yoga$YogaPositionType,
alignItems?: Yoga$Align,
alignSelf?: Yoga$Align,
alignContent?: Yoga$Align,
@@ -44,6 +44,10 @@ export type LayoutRecordT = RecordOf<{
flexWrap?: Yoga$FlexWrap,
aspectRatio?: number,
children?: List<LayoutRecordT>,
minWidth?: number,
maxWidth?: number,
minHeight?: number,
maxHeight?: number,
}>;
const r: LayoutRecordT = Record({
@@ -65,6 +69,10 @@ const r: LayoutRecordT = Record({
flexShrink: 1,
children: List(),
aspectRatio: 'auto',
minWidth: undefined,
maxWidth: undefined,
minHeight: undefined,
maxHeight: undefined,
});
export default r;

View File

@@ -107,6 +107,10 @@ export default class YogaNode extends Component<Props, State> {
const root = Node.create();
root.setWidth(layoutDefinition.width);
root.setHeight(layoutDefinition.height);
root.setMinWidth(layoutDefinition.minWidth);
root.setMaxWidth(layoutDefinition.maxWidth);
root.setMinHeight(layoutDefinition.minHeight);
root.setMaxHeight(layoutDefinition.maxHeight);
root.setJustifyContent(layoutDefinition.justifyContent);
root.setAlignItems(layoutDefinition.alignItems);
root.setAlignSelf(layoutDefinition.alignSelf);