Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

234
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda