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

288
Vistas
Warning: Can't perform a React state update on an unmounted component. Firebase Authentication

I'm using Firebase and Expo to authenticate the user information by registering and logging in, when I log in or register no warnings show up, but when I sign out from the app it returns the warning: Warning: Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in the componentWillUnmount method. I narrowed down the problem to these three screens. I tried with many fixes with no results.

App.js

let unsubscribe;
export class App extends Component {
  constructor(props) {
    super(props);
    this.state = {
      loaded: false,
    };
  }

  componentDidMount() {
    unsubscribe =  auth.onAuthStateChanged((user) => {
      if (!user) {
        this.setState({ loaded: true })
        this.setState({ loggedIn: false })
      } else {
        this.setState({ loaded: true })
        this.setState({ loggedIn: true })
      }
    })
  }

  componentWillUnmount() {
    unsubscribe()
  }

Account.js

export class Account extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      loaded: false,
      signedIn: false,
      modalVisible: false,
    }
  }
  

        

  onSignOut = () => {
    auth
      .signOut()
  }

Register.js

export class Register extends Component {
    constructor(props) {
        super(props);
        this.state = {
            email: '',
            password: '',
            phoneNumber: '',
            loaded: false
        }
    }


    componentDidMount() {
        this.setState({loaded: true})
    }

    componentWillUnmount() {
        this.signUp()
    }


    singUp = async () => {
        const { phoneNumber, email, password } = this.state;
        const number = '+1' + phoneNumber
        try {
            const phoneProvider = new PhoneAuthProvider(auth);
            const verificationId = await phoneProvider.verifyPhoneNumber(
              number,
              recaptchaVerifier.current
            );
            this.props.navigation.navigate('VerifyPhoneNumber', {
                verificationId: verificationId,
                phoneNumber: number,
                signInWithPhoneNumber: false,
                email: email,
                password: password
            })
          } catch (err) {
            Alert.alert(
                'Alert',
                `${err}`
            )
          }
        }
about 4 years ago · Juan Pablo Isaza
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