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

256
Visualizações
React Native eventEmitter.removeListener deprecated error

I am getting an deprecated error when using the follow code for removing event listener. When I try to use it anyway nothing happens. Can someone help me fix the code block so that I remove the event listen correctly. I am using this in a functional component

remove

eventEmitter.removeListener("PreparePaywallFinished", onPreparePaywallFinished);

add listener

eventEmitter.addListener("PreparePaywallFinished", onPreparePaywallFinished);

Here is same of the code I am working with

// raise paywall by event listener then clear listener after paywall is raised
const onPreparePaywallFinished = result => {
    if (result.success == true) {
      NativeModules.NamiPaywallManagerBridge.raisePaywall();
    } else {
      console.log('error is ' + result.errorMessage);
    }
    eventEmitter.addListener('PreparePaywallFinished', onPreparePaywallFinished)
      
  };

// create event listener on button press. also emit event
 const _handlePress = () => {
    console.log('pressed');
    const subscription =  eventEmitter.addListener('PreparePaywallFinished', onPreparePaywallFinished); //prettier-ignore
    NativeModules.NamiPaywallManagerBridge.preparePaywallForDisplay(true, 2); //prettier-ignore
  };

// button to be pressed 
return(
    <View>
        <Button title="press me" onPress={() => press()} />
    </View>
)
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

According to Native documents, this has been deprecated and not used. You can use .remove()

about 4 years ago · Juan Pablo Isaza Relatório
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