mirror of
https://github.com/balzack/databag.git
synced 2025-03-13 00:50:03 +00:00
clear splash once content is loaded
This commit is contained in:
parent
b2600b9879
commit
62cc78430d
@ -2,6 +2,7 @@ import {useRef, useState, useContext, useEffect} from 'react';
|
||||
import {DisplayContext} from '../context/DisplayContext';
|
||||
import {AppContext} from '../context/AppContext';
|
||||
import {ContextType} from '../context/ContextType';
|
||||
import SplashScreen from 'react-native-splash-screen';
|
||||
|
||||
export function useAccess() {
|
||||
const debounceAvailable = useRef(setTimeout(() => {}, 0));
|
||||
@ -29,6 +30,10 @@ export function useAccess() {
|
||||
setState(s => ({...s, ...value}));
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
SplashScreen.hide();
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
const {username, token, node, secure, mode} = state;
|
||||
if (mode === 'create') {
|
||||
|
@ -4,6 +4,8 @@ import {ContextType} from '../context/ContextType';
|
||||
import {useLocation, useNavigate} from 'react-router-dom';
|
||||
import SplashScreen from 'react-native-splash-screen';
|
||||
|
||||
const CLEAR_TIME = 5000;
|
||||
|
||||
export function useRoot() {
|
||||
const app = useContext(AppContext) as ContextType;
|
||||
const location = useLocation();
|
||||
@ -19,7 +21,7 @@ export function useRoot() {
|
||||
useEffect(() => {
|
||||
setTimeout(() => {
|
||||
SplashScreen.hide();
|
||||
}, 1000);
|
||||
}, CLEAR_TIME);
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
|
@ -3,6 +3,7 @@ import { AppState } from 'react-native';
|
||||
import {AppContext} from '../context/AppContext';
|
||||
import {DisplayContext} from '../context/DisplayContext';
|
||||
import {ContextType} from '../context/ContextType';
|
||||
import SplashScreen from 'react-native-splash-screen';
|
||||
|
||||
export function useSession() {
|
||||
const display = useContext(DisplayContext) as ContextType;
|
||||
@ -21,8 +22,9 @@ export function useSession() {
|
||||
|
||||
useEffect(() => {
|
||||
const setContentState = (loaded: boolean) => {
|
||||
console.log('content loaded: ', loaded);
|
||||
updateState({ loaded });
|
||||
if (loaded) {
|
||||
SplashScreen.hide();
|
||||
}
|
||||
}
|
||||
const setSdkState = (state: string) => {
|
||||
updateState({ sdkState: state === 'connected' });
|
||||
|
Loading…
Reference in New Issue
Block a user