Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

232
Views
React Native how to pass function as a parameter

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());
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!