Files
frontend/web-shims/react-native/Libraries/Utilities/codegenNativeCommands.js

15 lines
439 B
JavaScript
Raw Normal View History

function codegenNativeCommands(options) {
const commands = {};
if (options && options.supportedCommands) {
options.supportedCommands.forEach((commandName) => {
commands[commandName] = (ref, ...args) => {
if (ref && ref.current && typeof ref.current[commandName] === 'function') {
ref.current[commandName](...args);
}
};
});
}
return commands;
}
module.exports = codegenNativeCommands;