I am getting error that owScene is not a function. I am trying to pass a function as a parameter to another function. The code below is a slim down version of the full code. Basically scene.js will call the alert function. The alert function will show options to save. When a button is press from the alert.js function I am hoping to send the button press back out to the function from scene.js
scene.js
saveOptions('scene', owScene, handCancel);
const owScene = () => {
SaveMidi.overWrite(selections).then(() => {
navigation.goBack();
});
};
const handCancel = () => {
SaveMidi.overWrite(selections).then(() => {
navigation.goBack();
});
};
alert.js
const buttons = () => {
let options = [];
switch (alertType) {
case "scene":
options = [
{
text: "Cancel",
onPress: () => handCancel(),
style: "cancel",
},
{ text: "Overwrite", onPress: () => owScene() },
];
break;
case "volume":
options = [
{
text: "Cancel",
onPress: () => handCancel(),
style: "cancel",
},
{ text: "Overwrite", onPress: () => owVolume() },
];
break;
default:
break;
}
return options;
};
Alert.alert('Midi Mapping Alert', 'Select save option', buttons());