Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

233
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda