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

140
Views
How to check something while loading in expo?

I want to check if access token is present or not while splash screen is loading. How to do that in expo?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I found the solution :-)    
  ``// import....
    import * as SplashScreen from 'expo-splash-screen';
    //.......
    //.......function
    const [appIsReady, setAppIsReady] = useState(false);
    //.......
    useEffect(()=>{
        async function prepare() {
          try {
            await SplashScreen.preventAutoHideAsync();
            await isUser();  // checking for token availability
            await new Promise(resolve => setTimeout(resolve, 2000));
          } catch (e) {
            console.log(e);
          } finally {
            setAppIsReady(true);
          }
        };
        prepare();
      },[]);
    
    
      const onLayoutRootView = useCallback(async () => {
        if (appIsReady) {
          await SplashScreen.hideAsync();
        }
      }, [appIsReady]);
    
      if (!appIsReady) {
        return null;
      };
    
    return (
        <NavigationContainer>
          <View style={{flex:1,backgroundColor:"#e0ab24"}} onLayout= 
           {onLayoutRootView}>
          //.....(navigator)
          //....
          </View>
        </NavigationContainer>``

follow documentation : https://docs.expo.dev/versions/latest/sdk/splash-screen/

about 4 years ago · Juan Pablo Isaza Report
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!