Skip to content

Commit

Permalink
add static splash screen and icon
Browse files Browse the repository at this point in the history
  • Loading branch information
Risuleia committed Aug 27, 2023
1 parent 1102329 commit 81c016a
Show file tree
Hide file tree
Showing 7 changed files with 236 additions and 144 deletions.
7 changes: 6 additions & 1 deletion app.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,15 @@
"web": {
"bundler": "metro"
},
"icon": "./assets/icon.png",
"name": "Mentis",
"slug": "Mentis",
"plugins": [
"expo-router"
]
],
"splash": {
"image": "./assets/splash.png",
"backgroundColor": "#B1C0E8"
}
}
}
25 changes: 11 additions & 14 deletions app/_layout.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Stack } from "expo-router";
import { useCallback, useEffect, useState } from "react";
import * as Font from 'expo-font'
import * as SplashScreen from "expo-splash-screen";
import Splash from '../components/screens/Splash';
// import Splash from '../components/screens/Splash';

console.reportErrorsAsExceptions = false;

Expand All @@ -19,14 +19,8 @@ SplashScreen.preventAutoHideAsync();
function Layout() {

const [loading, setLoading] = useState(true)
const [animationVisible, setAnimationVisible] = useState(true)
// const [animationVisible, setAnimationVisible] = useState(true)

useEffect(() => {
setTimeout(() => {
setAnimationVisible(false)
}, 4000);
} , [])

useEffect(() => {
async function load() {
try {
Expand All @@ -38,27 +32,30 @@ function Layout() {
} catch (err) {
console.warn(err)
} finally {
setLoading(false)
// setInterval(() => {
setLoading(false)
// }, 4000);
}
}

load()
// setInterval(() => setAnimationVisible(false, 4000))
}, [])

const onLayoutRootView = useCallback(async () => {
if (!loading) await SplashScreen.hideAsync()
}, [loading])

if (loading) return null;
if (loading) return null

return (
animationVisible ? (
<Splash animationVisible={animationVisible} />
) : (
// loading ? (

// ) : (
<Stack onLayout={onLayoutRootView}>
<Stack.Screen name="(tabs)" options={{ headerShown: false }}/>
</Stack>
)
// )
)
}

Expand Down
Binary file added assets/_splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 81c016a

Please sign in to comment.