mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
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:
committed by
Facebook Github Bot
parent
bf78d7969a
commit
a02176e2ec
+10
@@ -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':
|
||||
|
||||
Reference in New Issue
Block a user