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

255
Vistas
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 Respuestas
Responde la pregunta

0

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

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