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

268
Vistas
TypeError: indefinido no es un objeto (evaluando 'appState.remove')

ingrese la descripción de la imagen aquí estoy teniendo dificultades con este error porque todo solía funcionar perfectamente ahora dice que está obsoleto. ¿Puede alguien ayudarme con el error porque nada funciona? He probado el nuevo código en la documentación de App State pero sigue el mismo error TypeError: indefinido no es un objeto (evaluando 'appState.remove')

Este es mi código:

 constructor(props) { super(props); this.state = { region: null, status: undefined, appState: AppState?.currentState, modalVisible: true, isLoading: true, }; this._getLocationAsync(); } componentDidMount() { AppState.removeEventListener("change", this.handleAppStateChange); } handleAppStateChange = (nextAppState) => { if ( this.state.appState.match(/inactive|background/) && nextAppState === "active" ) { this._getLocationAsync(); } this.setState({ appState: nextAppState }); }; componentWillUnmount() { AppState.addEventListener("change", this.handleAppStateChange); this._getLocationAsync(); } _getLocationAsync = async () => { let { status } = await Location.requestPermissionsAsync(); let location = await Location.getCurrentPositionAsync({ enableHighAccuracy: false, timeout: 10000, maximumAge: 0, }); let region = { latitude: location.coords.latitude, longitude: location.coords.longitude, latitudeDelta: 0.0045, longitudeDelta: 0.0045, }; this.props.callback({ latitude: region.latitude, longitude: region.longitude, }); this.setState({ region: region, status: status }); };
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

//listen to AppState change in componentDidMount componentDidMount() { this.subscriptionToAppState = AppState.addEventListener("change", this.handleAppStateChange); } //stop listen componentWillUnmount() { //if your react native version 0.65 or more use this this.subscriptionToAppState.remove(); //if your react native version min than v 0.65 use the deprecated methode like this this.subscriptionToAppState.removeEventListener("change", this.handleAppStateChange); }
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