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

247
Vistas
subscription returned by AppState.addEventListener() is void

when i try to remove the eventListener like in the React native documentation for AppState: https://reactnative.dev/docs/appstate, I either get an error that there is no such function remove() on undefined since AppState.addEventListener() returns void or the eventListener is just not removed.

here is my code:

useEffect(() => {
    const subscription = AppState.addEventListener('change', (nextAppState: any) => {
      // some stuff 
    });

    return () => {
      subscription.remove();
    };
  }, []);

If anyone has an idea on that matter, i would be very grateful, thank you !

I found someone on github with the same issue I believe: https://github.com/facebook/react-native/issues/33151

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

ok, found the answer this due to the fact that im on react-native 0.64 and not 0.67

about 4 years ago · Juan Pablo Isaza Denunciar

0

This happens if you're using a version of react-native prior to 0.65. Starting with 0.65, AppState.removeEventListener is deprecated in favor of using remove in the subscription returned by `addEventListener.

These are the 0.64 docs for removeEventListener. And these are the corresponding 0.65 docs that add the deprecation notice.

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