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

206
Vistas
Every time i refreshes my app it logs out even though i've used this onAuthStateChanged. Below is my code of loading screen

I'm using this screen to navigate between two screens by using the onAuthStateChanged but still every time It refresh the app it logs out even though I'm not log out.

import { View, Text, ActivityIndicator } from 'react-native'
import React, {useEffect } from 'react'
import { auth } from '../firebase';
import { useNavigation } from '@react-navigation/native';

const LoadingScreen = () => {
const navigation = useNavigation()
useEffect(() => {
    const unsubscribe = auth.onAuthStateChanged(user =>{
 if(user){
   navigation.replace('Chats') 
   //navigate to chat screen if user is exists
 }else{
   navigation.replace('Welcome') 
   //else navigate to first screen if no user
 }
 })
 return unsubscribe
 },[])
 return (
<View >
<ActivityIndicator size='large' />
</View>
 );
}

export default LoadingScreen
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