From 82911a8204da6b87e40ea808aa93c11056d43dc8 Mon Sep 17 00:00:00 2001 From: Pieter De Baets Date: Wed, 26 Oct 2016 13:12:26 -0700 Subject: [PATCH] s/CGFloat/float in RCTShadowView Reviewed By: emilsjolander Differential Revision: D4081788 fbshipit-source-id: 91da6af0fff1317ff4661572e8e7c1cc5594f810 --- React/Views/RCTShadowView.h | 65 ++++++++++++++++---------------- React/Views/RCTShadowView.m | 26 ++++++------- React/Views/RCTViewManager.m | 72 ++++++++++++++++++------------------ 3 files changed, 82 insertions(+), 81 deletions(-) diff --git a/React/Views/RCTShadowView.h b/React/Views/RCTShadowView.h index d5a9e3624..071b71cb2 100644 --- a/React/Views/RCTShadowView.h +++ b/React/Views/RCTShadowView.h @@ -72,18 +72,18 @@ typedef void (^RCTApplierBlock)(NSDictionary *viewRegistry * Position and dimensions. * Defaults to { 0, 0, NAN, NAN }. */ -@property (nonatomic, assign) CGFloat top; -@property (nonatomic, assign) CGFloat left; -@property (nonatomic, assign) CGFloat bottom; -@property (nonatomic, assign) CGFloat right; +@property (nonatomic, assign) float top; +@property (nonatomic, assign) float left; +@property (nonatomic, assign) float bottom; +@property (nonatomic, assign) float right; -@property (nonatomic, assign) CGFloat width; -@property (nonatomic, assign) CGFloat height; +@property (nonatomic, assign) float width; +@property (nonatomic, assign) float height; -@property (nonatomic, assign) CGFloat minWidth; -@property (nonatomic, assign) CGFloat maxWidth; -@property (nonatomic, assign) CGFloat minHeight; -@property (nonatomic, assign) CGFloat maxHeight; +@property (nonatomic, assign) float minWidth; +@property (nonatomic, assign) float maxWidth; +@property (nonatomic, assign) float minHeight; +@property (nonatomic, assign) float maxHeight; @property (nonatomic, assign) CGRect frame; @@ -99,33 +99,33 @@ typedef void (^RCTApplierBlock)(NSDictionary *viewRegistry /** * Border. Defaults to { 0, 0, 0, 0 }. */ -@property (nonatomic, assign) CGFloat borderWidth; -@property (nonatomic, assign) CGFloat borderTopWidth; -@property (nonatomic, assign) CGFloat borderLeftWidth; -@property (nonatomic, assign) CGFloat borderBottomWidth; -@property (nonatomic, assign) CGFloat borderRightWidth; +@property (nonatomic, assign) float borderWidth; +@property (nonatomic, assign) float borderTopWidth; +@property (nonatomic, assign) float borderLeftWidth; +@property (nonatomic, assign) float borderBottomWidth; +@property (nonatomic, assign) float borderRightWidth; /** * Margin. Defaults to { 0, 0, 0, 0 }. */ -@property (nonatomic, assign) CGFloat margin; -@property (nonatomic, assign) CGFloat marginVertical; -@property (nonatomic, assign) CGFloat marginHorizontal; -@property (nonatomic, assign) CGFloat marginTop; -@property (nonatomic, assign) CGFloat marginLeft; -@property (nonatomic, assign) CGFloat marginBottom; -@property (nonatomic, assign) CGFloat marginRight; +@property (nonatomic, assign) float margin; +@property (nonatomic, assign) float marginVertical; +@property (nonatomic, assign) float marginHorizontal; +@property (nonatomic, assign) float marginTop; +@property (nonatomic, assign) float marginLeft; +@property (nonatomic, assign) float marginBottom; +@property (nonatomic, assign) float marginRight; /** * Padding. Defaults to { 0, 0, 0, 0 }. */ -@property (nonatomic, assign) CGFloat padding; -@property (nonatomic, assign) CGFloat paddingVertical; -@property (nonatomic, assign) CGFloat paddingHorizontal; -@property (nonatomic, assign) CGFloat paddingTop; -@property (nonatomic, assign) CGFloat paddingLeft; -@property (nonatomic, assign) CGFloat paddingBottom; -@property (nonatomic, assign) CGFloat paddingRight; +@property (nonatomic, assign) float padding; +@property (nonatomic, assign) float paddingVertical; +@property (nonatomic, assign) float paddingHorizontal; +@property (nonatomic, assign) float paddingTop; +@property (nonatomic, assign) float paddingLeft; +@property (nonatomic, assign) float paddingBottom; +@property (nonatomic, assign) float paddingRight; - (UIEdgeInsets)paddingAsInsets; @@ -138,9 +138,10 @@ typedef void (^RCTApplierBlock)(NSDictionary *viewRegistry @property (nonatomic, assign) CSSAlign alignItems; @property (nonatomic, assign) CSSPositionType position; @property (nonatomic, assign) CSSWrapType flexWrap; -@property (nonatomic, assign) CGFloat flexGrow; -@property (nonatomic, assign) CGFloat flexShrink; -@property (nonatomic, assign) CGFloat flexBasis; + +@property (nonatomic, assign) float flexGrow; +@property (nonatomic, assign) float flexShrink; +@property (nonatomic, assign) float flexBasis; - (void)setFlex:(float)flex; diff --git a/React/Views/RCTShadowView.m b/React/Views/RCTShadowView.m index 76d4c37fe..5a8dd827b 100644 --- a/React/Views/RCTShadowView.m +++ b/React/Views/RCTShadowView.m @@ -440,12 +440,12 @@ DEFINE_PROCESS_META_PROPS(Border); // Margin #define RCT_MARGIN_PROPERTY(prop, metaProp) \ -- (void)setMargin##prop:(CGFloat)value \ +- (void)setMargin##prop:(float)value \ { \ _marginMetaProps[META_PROP_##metaProp] = value; \ _recomputeMargin = YES; \ } \ -- (CGFloat)margin##prop \ +- (float)margin##prop \ { \ return _marginMetaProps[META_PROP_##metaProp]; \ } @@ -461,12 +461,12 @@ RCT_MARGIN_PROPERTY(Right, RIGHT) // Padding #define RCT_PADDING_PROPERTY(prop, metaProp) \ -- (void)setPadding##prop:(CGFloat)value \ +- (void)setPadding##prop:(float)value \ { \ _paddingMetaProps[META_PROP_##metaProp] = value; \ _recomputePadding = YES; \ } \ -- (CGFloat)padding##prop \ +- (float)padding##prop \ { \ return _paddingMetaProps[META_PROP_##metaProp]; \ } @@ -509,12 +509,12 @@ RCT_PADDING_PROPERTY(Right, RIGHT) // Border #define RCT_BORDER_PROPERTY(prop, metaProp) \ -- (void)setBorder##prop##Width:(CGFloat)value \ +- (void)setBorder##prop##Width:(float)value \ { \ _borderMetaProps[META_PROP_##metaProp] = value; \ _recomputeBorder = YES; \ } \ -- (CGFloat)border##prop##Width \ +- (float)border##prop##Width \ { \ return _borderMetaProps[META_PROP_##metaProp]; \ } @@ -529,12 +529,12 @@ RCT_BORDER_PROPERTY(Right, RIGHT) #define RCT_DIMENSION_PROPERTY(setProp, getProp, cssProp) \ -- (void)set##setProp:(CGFloat)value \ +- (void)set##setProp:(float)value \ { \ CSSNodeStyleSet##cssProp(_cssNode, value); \ [self dirtyText]; \ } \ -- (CGFloat)getProp \ +- (float)getProp \ { \ return CSSNodeStyleGet##cssProp(_cssNode); \ } @@ -549,12 +549,12 @@ RCT_DIMENSION_PROPERTY(MaxHeight, maxHeight, MaxHeight) // Position #define RCT_POSITION_PROPERTY(setProp, getProp, edge) \ -- (void)set##setProp:(CGFloat)value \ +- (void)set##setProp:(float)value \ { \ CSSNodeStyleSetPosition(_cssNode, edge, value); \ [self dirtyText]; \ } \ -- (CGFloat)getProp \ +- (float)getProp \ { \ return CSSNodeStyleGetPosition(_cssNode, edge); \ } @@ -630,9 +630,9 @@ static inline void RCTAssignSuggestedDimension(CSSNodeRef cssNode, CSSDimension return CSSNodeStyleGet##cssProp(_cssNode); \ } -RCT_STYLE_PROPERTY(FlexGrow, flexGrow, FlexGrow, CGFloat) -RCT_STYLE_PROPERTY(FlexShrink, flexShrink, FlexShrink, CGFloat) -RCT_STYLE_PROPERTY(FlexBasis, flexBasis, FlexBasis, CGFloat) +RCT_STYLE_PROPERTY(FlexGrow, flexGrow, FlexGrow, float) +RCT_STYLE_PROPERTY(FlexShrink, flexShrink, FlexShrink, float) +RCT_STYLE_PROPERTY(FlexBasis, flexBasis, FlexBasis, float) RCT_STYLE_PROPERTY(FlexDirection, flexDirection, FlexDirection, CSSFlexDirection) RCT_STYLE_PROPERTY(JustifyContent, justifyContent, JustifyContent, CSSJustify) RCT_STYLE_PROPERTY(AlignSelf, alignSelf, AlignSelf, CSSAlign) diff --git a/React/Views/RCTViewManager.m b/React/Views/RCTViewManager.m index 012200d1f..51ef44a79 100644 --- a/React/Views/RCTViewManager.m +++ b/React/Views/RCTViewManager.m @@ -193,7 +193,7 @@ RCT_CUSTOM_VIEW_PROPERTY(borderColor, CGColor, RCTView) view.layer.borderColor = json ? [RCTConvert CGColor:json] : defaultView.layer.borderColor; } } -RCT_CUSTOM_VIEW_PROPERTY(borderWidth, CGFloat, RCTView) +RCT_CUSTOM_VIEW_PROPERTY(borderWidth, float, RCTView) { if ([view respondsToSelector:@selector(setBorderWidth:)]) { view.borderWidth = json ? [RCTConvert CGFloat:json] : defaultView.borderWidth; @@ -222,10 +222,10 @@ RCT_EXPORT_VIEW_PROPERTY(onAccessibilityTap, RCTDirectEventBlock) RCT_EXPORT_VIEW_PROPERTY(onMagicTap, RCTDirectEventBlock) #define RCT_VIEW_BORDER_PROPERTY(SIDE) \ -RCT_CUSTOM_VIEW_PROPERTY(border##SIDE##Width, CGFloat, RCTView) \ +RCT_CUSTOM_VIEW_PROPERTY(border##SIDE##Width, float, RCTView) \ { \ if ([view respondsToSelector:@selector(setBorder##SIDE##Width:)]) { \ - view.border##SIDE##Width = json ? [RCTConvert CGFloat:json] : defaultView.border##SIDE##Width; \ + view.border##SIDE##Width = json ? [RCTConvert float:json] : defaultView.border##SIDE##Width; \ } \ } \ RCT_CUSTOM_VIEW_PROPERTY(border##SIDE##Color, UIColor, RCTView) \ @@ -259,45 +259,45 @@ RCT_REMAP_VIEW_PROPERTY(zIndex, reactZIndex, NSInteger) RCT_EXPORT_SHADOW_PROPERTY(backgroundColor, UIColor) -RCT_EXPORT_SHADOW_PROPERTY(top, CGFloat) -RCT_EXPORT_SHADOW_PROPERTY(right, CGFloat) -RCT_EXPORT_SHADOW_PROPERTY(bottom, CGFloat) -RCT_EXPORT_SHADOW_PROPERTY(left, CGFloat); +RCT_EXPORT_SHADOW_PROPERTY(top, float) +RCT_EXPORT_SHADOW_PROPERTY(right, float) +RCT_EXPORT_SHADOW_PROPERTY(bottom, float) +RCT_EXPORT_SHADOW_PROPERTY(left, float); -RCT_EXPORT_SHADOW_PROPERTY(width, CGFloat) -RCT_EXPORT_SHADOW_PROPERTY(height, CGFloat) +RCT_EXPORT_SHADOW_PROPERTY(width, float) +RCT_EXPORT_SHADOW_PROPERTY(height, float) -RCT_EXPORT_SHADOW_PROPERTY(minWidth, CGFloat) -RCT_EXPORT_SHADOW_PROPERTY(maxWidth, CGFloat) -RCT_EXPORT_SHADOW_PROPERTY(minHeight, CGFloat) -RCT_EXPORT_SHADOW_PROPERTY(maxHeight, CGFloat) +RCT_EXPORT_SHADOW_PROPERTY(minWidth, float) +RCT_EXPORT_SHADOW_PROPERTY(maxWidth, float) +RCT_EXPORT_SHADOW_PROPERTY(minHeight, float) +RCT_EXPORT_SHADOW_PROPERTY(maxHeight, float) -RCT_EXPORT_SHADOW_PROPERTY(borderTopWidth, CGFloat) -RCT_EXPORT_SHADOW_PROPERTY(borderRightWidth, CGFloat) -RCT_EXPORT_SHADOW_PROPERTY(borderBottomWidth, CGFloat) -RCT_EXPORT_SHADOW_PROPERTY(borderLeftWidth, CGFloat) -RCT_EXPORT_SHADOW_PROPERTY(borderWidth, CGFloat) +RCT_EXPORT_SHADOW_PROPERTY(borderTopWidth, float) +RCT_EXPORT_SHADOW_PROPERTY(borderRightWidth, float) +RCT_EXPORT_SHADOW_PROPERTY(borderBottomWidth, float) +RCT_EXPORT_SHADOW_PROPERTY(borderLeftWidth, float) +RCT_EXPORT_SHADOW_PROPERTY(borderWidth, float) -RCT_EXPORT_SHADOW_PROPERTY(marginTop, CGFloat) -RCT_EXPORT_SHADOW_PROPERTY(marginRight, CGFloat) -RCT_EXPORT_SHADOW_PROPERTY(marginBottom, CGFloat) -RCT_EXPORT_SHADOW_PROPERTY(marginLeft, CGFloat) -RCT_EXPORT_SHADOW_PROPERTY(marginVertical, CGFloat) -RCT_EXPORT_SHADOW_PROPERTY(marginHorizontal, CGFloat) -RCT_EXPORT_SHADOW_PROPERTY(margin, CGFloat) +RCT_EXPORT_SHADOW_PROPERTY(marginTop, float) +RCT_EXPORT_SHADOW_PROPERTY(marginRight, float) +RCT_EXPORT_SHADOW_PROPERTY(marginBottom, float) +RCT_EXPORT_SHADOW_PROPERTY(marginLeft, float) +RCT_EXPORT_SHADOW_PROPERTY(marginVertical, float) +RCT_EXPORT_SHADOW_PROPERTY(marginHorizontal, float) +RCT_EXPORT_SHADOW_PROPERTY(margin, float) -RCT_EXPORT_SHADOW_PROPERTY(paddingTop, CGFloat) -RCT_EXPORT_SHADOW_PROPERTY(paddingRight, CGFloat) -RCT_EXPORT_SHADOW_PROPERTY(paddingBottom, CGFloat) -RCT_EXPORT_SHADOW_PROPERTY(paddingLeft, CGFloat) -RCT_EXPORT_SHADOW_PROPERTY(paddingVertical, CGFloat) -RCT_EXPORT_SHADOW_PROPERTY(paddingHorizontal, CGFloat) -RCT_EXPORT_SHADOW_PROPERTY(padding, CGFloat) +RCT_EXPORT_SHADOW_PROPERTY(paddingTop, float) +RCT_EXPORT_SHADOW_PROPERTY(paddingRight, float) +RCT_EXPORT_SHADOW_PROPERTY(paddingBottom, float) +RCT_EXPORT_SHADOW_PROPERTY(paddingLeft, float) +RCT_EXPORT_SHADOW_PROPERTY(paddingVertical, float) +RCT_EXPORT_SHADOW_PROPERTY(paddingHorizontal, float) +RCT_EXPORT_SHADOW_PROPERTY(padding, float) -RCT_EXPORT_SHADOW_PROPERTY(flex, CGFloat) -RCT_EXPORT_SHADOW_PROPERTY(flexGrow, CGFloat) -RCT_EXPORT_SHADOW_PROPERTY(flexShrink, CGFloat) -RCT_EXPORT_SHADOW_PROPERTY(flexBasis, CGFloat) +RCT_EXPORT_SHADOW_PROPERTY(flex, float) +RCT_EXPORT_SHADOW_PROPERTY(flexGrow, float) +RCT_EXPORT_SHADOW_PROPERTY(flexShrink, float) +RCT_EXPORT_SHADOW_PROPERTY(flexBasis, float) RCT_EXPORT_SHADOW_PROPERTY(flexDirection, CSSFlexDirection) RCT_EXPORT_SHADOW_PROPERTY(flexWrap, CSSWrapType) RCT_EXPORT_SHADOW_PROPERTY(justifyContent, CSSJustify)