Add support for Double prop type

Summary: Support a prop-type `Double`, in addition to `Float`, for flow typing and codegen of components.

Reviewed By: TheSavior

Differential Revision: D16812812

fbshipit-source-id: b5588b3218636283a4e9c5d17212dd0b92986eb9
This commit is contained in:
Joshua Gross
2019-08-14 15:33:41 -07:00
committed by Facebook Github Bot
parent bf78d7969a
commit a02176e2ec
20 changed files with 457 additions and 2 deletions
@@ -66,6 +66,14 @@ function getJavaValueForProp(
return `value == null ? ${
typeAnnotation.default
} : ((Double) value).intValue()`;
case 'DoubleTypeAnnotation':
if (prop.optional) {
return `value == null ? ${
typeAnnotation.default
}f : ((Double) value).doubleValue()`;
} else {
return 'value == null ? Double.NaN : ((Double) value).doubleValue()';
}
case 'FloatTypeAnnotation':
if (prop.optional) {
return `value == null ? ${
@@ -129,6 +137,8 @@ function getCommandArgJavaType(param) {
switch (param.typeAnnotation.type) {
case 'BooleanTypeAnnotation':
return 'getBoolean';
case 'DoubleTypeAnnotation':
return 'getDouble';
case 'FloatTypeAnnotation':
return 'getFloat';
case 'Int32TypeAnnotation':