From 0fd376a004c209479a67499a08f2e9ee7912811f Mon Sep 17 00:00:00 2001 From: Dmitry Gladkov Date: Mon, 18 Jan 2016 20:21:58 +0200 Subject: [PATCH 1/3] use platform agnostic package entry point --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5dd7b66..d6f792e 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "react-native-linear-gradient", "version": "1.3.1", "description": "A element for react-native", - "main": "index.ios.js", + "main": "index", "author": { "name": "Brent Vatne", "email": "brentvatne@gmail.com", From b63f00ab0bf77b275703c9eef3664ecafc30f502 Mon Sep 17 00:00:00 2001 From: Dmitry Gladkov Date: Mon, 18 Jan 2016 20:27:07 +0200 Subject: [PATCH 2/3] use 1 as default gradient end position on Android --- .../src/main/java/com/BV/LinearGradient/LinearGradientView.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/android/src/main/java/com/BV/LinearGradient/LinearGradientView.java b/android/src/main/java/com/BV/LinearGradient/LinearGradientView.java index f83d3ac..5c4cabd 100644 --- a/android/src/main/java/com/BV/LinearGradient/LinearGradientView.java +++ b/android/src/main/java/com/BV/LinearGradient/LinearGradientView.java @@ -65,7 +65,7 @@ public class LinearGradientView extends View { mEndPos= new float[]{(float) endPos.getDouble(0), (float) endPos.getDouble(1)}; } catch (Exception e) { //default to full height. - mEndPos = new float[]{0, getMeasuredHeight()}; + mEndPos = new float[]{0, 1}; } mSize = new int[]{0, 0}; drawGradient(); From 81922a5089658b7888feef9fe21b32f3e714a895 Mon Sep 17 00:00:00 2001 From: Dmitry Gladkov Date: Mon, 18 Jan 2016 20:30:39 +0200 Subject: [PATCH 3/3] style changes --- .../java/com/BV/LinearGradient/LinearGradientView.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/android/src/main/java/com/BV/LinearGradient/LinearGradientView.java b/android/src/main/java/com/BV/LinearGradient/LinearGradientView.java index 5c4cabd..19b2e02 100644 --- a/android/src/main/java/com/BV/LinearGradient/LinearGradientView.java +++ b/android/src/main/java/com/BV/LinearGradient/LinearGradientView.java @@ -29,15 +29,15 @@ public class LinearGradientView extends View { ReadableArray colors = props.getArray("colors"); - //If we managed to get here and not get colors... give up. + // if we managed to get here and not get colors, give up. assert colors != null; + mColors = new int[colors.size()]; for (int i=0; i < mColors.length; i++) { mColors[i] = colors.getInt(i); } - try { ReadableArray locations = props.getArray("locations"); assert locations != null; @@ -58,13 +58,12 @@ public class LinearGradientView extends View { mStartPos = new float[]{0,0}; } - try { ReadableArray endPos = props.getArray("end"); assert endPos != null; mEndPos= new float[]{(float) endPos.getDouble(0), (float) endPos.getDouble(1)}; } catch (Exception e) { - //default to full height. + // default to full height. mEndPos = new float[]{0, 1}; } mSize = new int[]{0, 0};