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

215
Views
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
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!