Summary: Updates the casting for Java props

Reviewed By: JoshuaGross

Differential Revision: D16417805

fbshipit-source-id: 7881ff984527555a4905b62d83751ed2a43b1070
This commit is contained in:
Rick Hanlon 2019-07-24 10:29:39 -07:00 коммит произвёл Facebook Github Bot
Родитель 58d3cb2fff
Коммит 34505dba05
2 изменённых файлов: 15 добавлений и 15 удалений

Просмотреть файл

@ -44,13 +44,13 @@ function getJavaValueForProp(
case 'StringTypeAnnotation': case 'StringTypeAnnotation':
return '(String) value'; return '(String) value';
case 'Int32TypeAnnotation': case 'Int32TypeAnnotation':
return '(int) value'; return '((Double) value).intValue()';
case 'FloatTypeAnnotation': case 'FloatTypeAnnotation':
return '(Float) value'; return '((Double) value).floatValue()';
case 'NativePrimitiveTypeAnnotation': case 'NativePrimitiveTypeAnnotation':
switch (typeAnnotation.name) { switch (typeAnnotation.name) {
case 'ColorPrimitive': case 'ColorPrimitive':
return '(Integer) value'; return '((Double) value).intValue()';
case 'ImageSourcePrimitive': case 'ImageSourcePrimitive':
return '(ReadableMap) value'; return '(ReadableMap) value';
case 'PointPrimitive': case 'PointPrimitive':

Просмотреть файл

@ -73,7 +73,7 @@ public class ColorPropNativeComponentDelegate<T extends View> {
public void setProperty(ColorPropNativeComponentInterface<T> viewManager, T view, String propName, Object value) { public void setProperty(ColorPropNativeComponentInterface<T> viewManager, T view, String propName, Object value) {
switch (propName) { switch (propName) {
case \\"tintColor\\": case \\"tintColor\\":
viewManager.setTintColor(view, (Integer) value); viewManager.setTintColor(view, ((Double) value).intValue());
break; break;
} }
} }
@ -205,22 +205,22 @@ public class FloatPropNativeComponentDelegate<T extends View> {
public void setProperty(FloatPropNativeComponentInterface<T> viewManager, T view, String propName, Object value) { public void setProperty(FloatPropNativeComponentInterface<T> viewManager, T view, String propName, Object value) {
switch (propName) { switch (propName) {
case \\"blurRadius\\": case \\"blurRadius\\":
viewManager.setBlurRadius(view, (Float) value); viewManager.setBlurRadius(view, ((Double) value).floatValue());
break; break;
case \\"blurRadius2\\": case \\"blurRadius2\\":
viewManager.setBlurRadius2(view, (Float) value); viewManager.setBlurRadius2(view, ((Double) value).floatValue());
break; break;
case \\"blurRadius3\\": case \\"blurRadius3\\":
viewManager.setBlurRadius3(view, (Float) value); viewManager.setBlurRadius3(view, ((Double) value).floatValue());
break; break;
case \\"blurRadius4\\": case \\"blurRadius4\\":
viewManager.setBlurRadius4(view, (Float) value); viewManager.setBlurRadius4(view, ((Double) value).floatValue());
break; break;
case \\"blurRadius5\\": case \\"blurRadius5\\":
viewManager.setBlurRadius5(view, (Float) value); viewManager.setBlurRadius5(view, ((Double) value).floatValue());
break; break;
case \\"blurRadius6\\": case \\"blurRadius6\\":
viewManager.setBlurRadius6(view, (Float) value); viewManager.setBlurRadius6(view, ((Double) value).floatValue());
break; break;
} }
} }
@ -261,13 +261,13 @@ public class IntegerPropNativeComponentDelegate<T extends View> {
public void setProperty(IntegerPropNativeComponentInterface<T> viewManager, T view, String propName, Object value) { public void setProperty(IntegerPropNativeComponentInterface<T> viewManager, T view, String propName, Object value) {
switch (propName) { switch (propName) {
case \\"progress1\\": case \\"progress1\\":
viewManager.setProgress1(view, (int) value); viewManager.setProgress1(view, ((Double) value).intValue());
break; break;
case \\"progress2\\": case \\"progress2\\":
viewManager.setProgress2(view, (int) value); viewManager.setProgress2(view, ((Double) value).intValue());
break; break;
case \\"progress3\\": case \\"progress3\\":
viewManager.setProgress3(view, (int) value); viewManager.setProgress3(view, ((Double) value).intValue());
break; break;
} }
} }
@ -311,10 +311,10 @@ public class ImageColorPropNativeComponentDelegate<T extends View> {
viewManager.setThumbImage(view, (ReadableMap) value); viewManager.setThumbImage(view, (ReadableMap) value);
break; break;
case \\"color\\": case \\"color\\":
viewManager.setColor(view, (Integer) value); viewManager.setColor(view, ((Double) value).intValue());
break; break;
case \\"thumbTintColor\\": case \\"thumbTintColor\\":
viewManager.setThumbTintColor(view, (Integer) value); viewManager.setThumbTintColor(view, ((Double) value).intValue());
break; break;
case \\"point\\": case \\"point\\":
viewManager.setPoint(view, (ReadableMap) value); viewManager.setPoint(view, (ReadableMap) value);