remove loading for now
This commit is contained in:
@@ -1,39 +0,0 @@
|
||||
import React, { createContext, useEffect, useState } from "react";
|
||||
import { ActivityIndicator, StyleSheet, View } from "react-native";
|
||||
|
||||
import AsyncStorage from "@react-native-async-storage/async-storage";
|
||||
import { colors } from "../../styles";
|
||||
|
||||
const LoadingContext = createContext<boolean>(false);
|
||||
|
||||
export default function Loading({ children }) {
|
||||
const [loading, setLoading] = useState(true);
|
||||
|
||||
useEffect(() => {
|
||||
const checkHasToken = async () => {
|
||||
const hasToken = await AsyncStorage.getItem("token");
|
||||
// needs to connect to app state
|
||||
return hasToken;
|
||||
};
|
||||
|
||||
checkHasToken().then(() => setLoading(false));
|
||||
}, []);
|
||||
|
||||
if (!loading) {
|
||||
return (
|
||||
<LoadingContext.Provider value={loading}>
|
||||
{children}
|
||||
</LoadingContext.Provider>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<View style={s.container}>
|
||||
<ActivityIndicator size="large" color={colors.tournamentBlue} />
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
const s = StyleSheet.create({
|
||||
container: { flex: 1, justifyContent: "center", alignItems: "center" },
|
||||
});
|
Reference in New Issue
Block a user