Fix Java compile errors in JS-generated receiveCommand method

Summary: This diff adds a missing `switch` statement

Reviewed By: makovkastar

Differential Revision: D16892042

fbshipit-source-id: c162655445f3c0891d2377595a9389d419713bdf
This commit is contained in:
Eli White authored and Facebook Github Bot committed 2019-08-19 11:53:27 -07:00
1 parent b9899222a3
commit cddc2c6c72
2 files changed
+22 -16

No files matched your search

@@ -43,7 +43,9 @@ const propSetterTemplate = `
const commandsTemplate = `
public void receiveCommand(::_INTERFACE_CLASSNAME_::<T> viewManager, T view, String commandName, ReadableArray args) {
::_COMMAND_CASES_::
switch (commandName) {
::_COMMAND_CASES_::
}
}
`;
@@ -173,13 +175,13 @@ function generateCommandCasesString(
const commandMethods = component.commands
.map(command => {
return `case "${command.name}":
viewManager.${toSafeJavaString(
command.name,
false,
)}(${getCommandArguments(command)});
break;`;
viewManager.${toSafeJavaString(
command.name,
false,
)}(${getCommandArguments(command)});
break;`;
})
.join('\n' + ' ');
.join('\n' + ' ');
return commandMethods;
}
@@ -168,12 +168,14 @@ public class CommandNativeComponentManagerDelegate<T extends View, U extends Bas
}
public void receiveCommand(CommandNativeComponentManagerInterface<T> viewManager, T view, String commandName, ReadableArray args) {
case \\"flashScrollIndicators\\":
viewManager.flashScrollIndicators(view);
break;
case \\"allTypes\\":
viewManager.allTypes(view, args.getInt(0), args.getFloat(1), args.getDouble(2), args.getString(3), args.getBoolean(4));
break;
switch (commandName) {
case \\"flashScrollIndicators\\":
viewManager.flashScrollIndicators(view);
break;
case \\"allTypes\\":
viewManager.allTypes(view, args.getInt(0), args.getFloat(1), args.getDouble(2), args.getString(3), args.getBoolean(4));
break;
}
}
}
",
@@ -208,9 +210,11 @@ public class CommandNativeComponentManagerDelegate<T extends View, U extends Bas
}
public void receiveCommand(CommandNativeComponentManagerInterface<T> viewManager, T view, String commandName, ReadableArray args) {
case \\"hotspotUpdate\\":
viewManager.hotspotUpdate(view, args.getInt(0), args.getInt(1));
break;
switch (commandName) {
case \\"hotspotUpdate\\":
viewManager.hotspotUpdate(view, args.getInt(0), args.getInt(1));
break;
}
}
}
",