Merge pull request #53 from dgladkov/issue52

Fix package entry point and default end position value on Android
This commit is contained in:
Brent Vatne 2016-01-18 11:39:36 -08:00
commit 2f6d87951a
2 changed files with 5 additions and 6 deletions

View File

@ -29,15 +29,15 @@ public class LinearGradientView extends View {
ReadableArray colors = props.getArray("colors"); 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; assert colors != null;
mColors = new int[colors.size()]; mColors = new int[colors.size()];
for (int i=0; i < mColors.length; i++) for (int i=0; i < mColors.length; i++)
{ {
mColors[i] = colors.getInt(i); mColors[i] = colors.getInt(i);
} }
try { try {
ReadableArray locations = props.getArray("locations"); ReadableArray locations = props.getArray("locations");
assert locations != null; assert locations != null;
@ -58,14 +58,13 @@ public class LinearGradientView extends View {
mStartPos = new float[]{0,0}; mStartPos = new float[]{0,0};
} }
try { try {
ReadableArray endPos = props.getArray("end"); ReadableArray endPos = props.getArray("end");
assert endPos != null; assert endPos != null;
mEndPos= new float[]{(float) endPos.getDouble(0), (float) endPos.getDouble(1)}; mEndPos= new float[]{(float) endPos.getDouble(0), (float) endPos.getDouble(1)};
} catch (Exception e) { } catch (Exception e) {
//default to full height. // default to full height.
mEndPos = new float[]{0, getMeasuredHeight()}; mEndPos = new float[]{0, 1};
} }
mSize = new int[]{0, 0}; mSize = new int[]{0, 0};
drawGradient(); drawGradient();

View File

@ -2,7 +2,7 @@
"name": "react-native-linear-gradient", "name": "react-native-linear-gradient",
"version": "1.3.1", "version": "1.3.1",
"description": "A <LinearGradient> element for react-native", "description": "A <LinearGradient> element for react-native",
"main": "index.ios.js", "main": "index",
"author": { "author": {
"name": "Brent Vatne", "name": "Brent Vatne",
"email": "brentvatne@gmail.com", "email": "brentvatne@gmail.com",