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

254
Views
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 answers
Answer question

0

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

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