From a77528523e34be6e91a9fe642ab67ceb04e8e0ae Mon Sep 17 00:00:00 2001 From: Sam Mueller Date: Wed, 15 Nov 2017 23:31:10 -0800 Subject: [PATCH] Rename start & end properties to fix conflict with RN 51 A recent commit in RN added start/end properties to RCTViewManager. Because LinearGradient inherits from this class and has properties of the same name, RN gets mixed up and tries to convert to a YGValue instead of CGPoint, which results in the exception: ``` Error setting property 'start' of BVLinearGradient with tag #18: JSON value '{ x = 0; y = 0; }' of type NSMutableDictionary cannot be converted to a YGValue. ``` --- BVLinearGradient/BVLinearGradient.m | 8 ++++---- BVLinearGradient/BVLinearGradientManager.m | 4 ++-- .../java/com/BV/LinearGradient/LinearGradientManager.java | 4 ++-- index.android.js | 4 ++-- index.ios.js | 4 ++-- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/BVLinearGradient/BVLinearGradient.m b/BVLinearGradient/BVLinearGradient.m index f1fad5b..24cbbbd 100644 --- a/BVLinearGradient/BVLinearGradient.m +++ b/BVLinearGradient/BVLinearGradient.m @@ -24,14 +24,14 @@ self.gradientLayer.colors = colors; } -- (void)setStart:(CGPoint)start +- (void)setStartPoint:(CGPoint)startPoint { - self.gradientLayer.startPoint = start; + self.gradientLayer.startPoint = startPoint; } -- (void)setEnd:(CGPoint)end +- (void)setEndPoint:(CGPoint)endPoint { - self.gradientLayer.endPoint = end; + self.gradientLayer.endPoint = endPoint; } - (void)setLocations:(NSArray *)locations diff --git a/BVLinearGradient/BVLinearGradientManager.m b/BVLinearGradient/BVLinearGradientManager.m index 6a43a35..13e0f13 100644 --- a/BVLinearGradient/BVLinearGradientManager.m +++ b/BVLinearGradient/BVLinearGradientManager.m @@ -19,8 +19,8 @@ RCT_EXPORT_MODULE(); } RCT_EXPORT_VIEW_PROPERTY(colors, NSArray); -RCT_EXPORT_VIEW_PROPERTY(start, CGPoint); -RCT_EXPORT_VIEW_PROPERTY(end, CGPoint); +RCT_EXPORT_VIEW_PROPERTY(startPoint, CGPoint); +RCT_EXPORT_VIEW_PROPERTY(endPoint, CGPoint); RCT_EXPORT_VIEW_PROPERTY(locations, NSArray); @end diff --git a/android/src/main/java/com/BV/LinearGradient/LinearGradientManager.java b/android/src/main/java/com/BV/LinearGradient/LinearGradientManager.java index 5c31cf5..36791cf 100644 --- a/android/src/main/java/com/BV/LinearGradient/LinearGradientManager.java +++ b/android/src/main/java/com/BV/LinearGradient/LinearGradientManager.java @@ -13,8 +13,8 @@ public class LinearGradientManager extends SimpleViewManager public static final String REACT_CLASS = "BVLinearGradient"; public static final String PROP_COLORS = "colors"; public static final String PROP_LOCATIONS = "locations"; - public static final String PROP_START_POS = "start"; - public static final String PROP_END_POS = "end"; + public static final String PROP_START_POS = "startPoint"; + public static final String PROP_END_POS = "endPoint"; public static final String PROP_BORDER_RADII = "borderRadii"; @Override diff --git a/index.android.js b/index.android.js index 279118b..2c4643e 100644 --- a/index.android.js +++ b/index.android.js @@ -89,8 +89,8 @@ export default class LinearGradient extends Component { diff --git a/index.ios.js b/index.ios.js index bf387ff..31bf50d 100644 --- a/index.ios.js +++ b/index.ios.js @@ -72,8 +72,8 @@ export default class LinearGradient extends Component { { this.gradientRef = component; }} {...otherProps} - start={convertPoint('start', start)} - end={convertPoint('end', end)} + startPoint={convertPoint('start', start)} + endPoint={convertPoint('end', end)} colors={colors.map(processColor)} locations={locations ? locations.slice(0, colors.length) : null} />