mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Codegen Android: handle nullable getConstants() properties generation.
Summary: The GenerateModuleJavaSpec.js mistakenly treated nullable getConstants() properties as required, such that the Java spec will throw an exception when the properties are missing. This fixed it. Note that the JavaPoet-based generator got this correct already. Changelog: [Internal] Differential Revision: D24381941 fbshipit-source-id: c95d2181c66443e2191318f09b6454a5296009e4
This commit is contained in:
committed by
Facebook GitHub Bot
parent
4e8326a82e
commit
4dfa3be871
+1
-2
@@ -203,8 +203,7 @@ function buildGetConstantsMethod(
|
||||
const rawProperties =
|
||||
methodTypeAnnotation.returnTypeAnnotation.properties || [];
|
||||
rawProperties.forEach(p => {
|
||||
// TODO(T76712813): Should we push to optionalProps if the constant is nullable?
|
||||
if (p.optional) {
|
||||
if (p.optional || p.typeAnnotation.type === 'NullableTypeAnnotation') {
|
||||
optionalProps.push(p.name);
|
||||
} else {
|
||||
requiredProps.push(p.name);
|
||||
|
||||
Reference in New Issue
Block a user