From 41f3d0cf2d0b20315969b68895e9e217b114544c Mon Sep 17 00:00:00 2001 From: Pieter De Baets Date: Mon, 13 Mar 2017 05:58:09 -0700 Subject: [PATCH] Expose getter for 'flex' property Summary: Helps mitigate part of https://github.com/facebook/react-native/pull/12245 while we wait for a more comprehensive solution. Reviewed By: emilsjolander Differential Revision: D4571776 fbshipit-source-id: 185cd1b0d3af37724136a37471df412c2000dfe4 --- React/Views/RCTShadowView.h | 3 +-- React/Views/RCTShadowView.m | 6 +----- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/React/Views/RCTShadowView.h b/React/Views/RCTShadowView.h index bc15bfe59..61154b1d6 100644 --- a/React/Views/RCTShadowView.h +++ b/React/Views/RCTShadowView.h @@ -135,14 +135,13 @@ typedef void (^RCTApplierBlock)(NSDictionary *viewRegistry @property (nonatomic, assign) YGWrap flexWrap; @property (nonatomic, assign) YGDisplay display; +@property (nonatomic, assign) float flex; @property (nonatomic, assign) float flexGrow; @property (nonatomic, assign) float flexShrink; @property (nonatomic, assign) YGValue flexBasis; @property (nonatomic, assign) float aspectRatio; -- (void)setFlex:(float)flex; - /** * z-index, used to override sibling order in the view */ diff --git a/React/Views/RCTShadowView.m b/React/Views/RCTShadowView.m index c50f38281..8de41aaca 100644 --- a/React/Views/RCTShadowView.m +++ b/React/Views/RCTShadowView.m @@ -669,11 +669,6 @@ static inline YGSize RCTShadowViewMeasure(YGNodeRef node, float width, YGMeasure // Flex -- (void)setFlex:(float)value -{ - YGNodeStyleSetFlex(_yogaNode, value); -} - - (void)setFlexBasis:(YGValue)value { RCT_SET_YGVALUE_AUTO(value, YGNodeStyleSetFlexBasis, _yogaNode); @@ -694,6 +689,7 @@ static inline YGSize RCTShadowViewMeasure(YGNodeRef node, float width, YGMeasure return YGNodeStyleGet##cssProp(_yogaNode); \ } +RCT_STYLE_PROPERTY(Flex, flex, Flex, float) RCT_STYLE_PROPERTY(FlexGrow, flexGrow, FlexGrow, float) RCT_STYLE_PROPERTY(FlexShrink, flexShrink, FlexShrink, float) RCT_STYLE_PROPERTY(FlexDirection, flexDirection, FlexDirection, YGFlexDirection)