From 69242938f7f8705b28d9ab2b4d4be101f3bd741d Mon Sep 17 00:00:00 2001 From: Pritesh Nandgaonkar Date: Thu, 15 Feb 2018 06:12:14 -0800 Subject: [PATCH] Add min/max in YogaRecord Summary: Add min/max in YogaRecord Reviewed By: emilsjolander Differential Revision: D6998533 fbshipit-source-id: 4613c99bd3a4cb3b8fbe577909157b25f3bef9c7 --- website/src/components/Playground/LayoutRecord.js | 12 ++++++++++-- website/src/components/Playground/YogaNode.js | 4 ++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/website/src/components/Playground/LayoutRecord.js b/website/src/components/Playground/LayoutRecord.js index 7822ca6b..b9657490 100644 --- a/website/src/components/Playground/LayoutRecord.js +++ b/website/src/components/Playground/LayoutRecord.js @@ -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, + 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; diff --git a/website/src/components/Playground/YogaNode.js b/website/src/components/Playground/YogaNode.js index fdc7a281..81c0a7b9 100644 --- a/website/src/components/Playground/YogaNode.js +++ b/website/src/components/Playground/YogaNode.js @@ -107,6 +107,10 @@ export default class YogaNode extends Component { 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);