mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Add @Nullable to WritableMap and WritableArray for Android Java spec generator
Summary: We're adding a native module that returns a Nullable type. This makes the Java spec and the implementation to be the same. Changelog: [Android][Added] - Generate `Nullable` for optional objects and arrays in module codegen. Reviewed By: yungsters Differential Revision: D35651333 fbshipit-source-id: d73c87340e33cf79831915ce6892e457ef369175
This commit is contained in:
committed by
Facebook GitHub Bot
parent
6958bbb28c
commit
ffaa5d69bc
+3
-3
@@ -212,13 +212,13 @@ function translateFunctionReturnTypeToJavaType(
|
||||
return nullable ? 'Boolean' : 'boolean';
|
||||
case 'ObjectTypeAnnotation':
|
||||
imports.add('com.facebook.react.bridge.WritableMap');
|
||||
return 'WritableMap';
|
||||
return wrapIntoNullableIfNeeded('WritableMap');
|
||||
case 'GenericObjectTypeAnnotation':
|
||||
imports.add('com.facebook.react.bridge.WritableMap');
|
||||
return 'WritableMap';
|
||||
return wrapIntoNullableIfNeeded('WritableMap');
|
||||
case 'ArrayTypeAnnotation':
|
||||
imports.add('com.facebook.react.bridge.WritableArray');
|
||||
return 'WritableArray';
|
||||
return wrapIntoNullableIfNeeded('WritableArray');
|
||||
default:
|
||||
(realTypeAnnotation.type: empty);
|
||||
throw new Error(createErrorMessage(realTypeAnnotation.type));
|
||||
|
||||
Reference in New Issue
Block a user