Hello,
This is more a fix suggestion than a question.
I wanted to use a very simple loading screen like this:
return (
<>
<LayoutSplashScreen visible={showSplashScreen} />
{children}
</>
)
useEffect(() => {
disableSplashScreen()
}, [])
<MetronicSplashScreenContext.Provider value={{setCount, visible}}>
{children}
</MetronicSplashScreenContext.Provider>
const [splashScreenShown, setSplashScreenShown] = useState(false)
const {visible} = useContext(MetronicSplashScreenContext)
useEffect(() => {
if (visible && !splashScreenShown) {
setSplashScreenShown(true)
} else if (!visible && splashScreenShown) {
disableSplashScreen()
}
}, [visible, splashScreenShown, disableSplashScreen])
<LayoutSplashScreen visible={showSplashScreen} />
Also, there is no class "hidden" defined in metronic, this code in MetronicSplashScreen is not working:
useEffect(() => {
const splashScreen = document.getElementById("splash-screen")
// Show SplashScreen
if (splashScreen && visible) {
splashScreen.classList.remove("hidden")
return () => {
splashScreen.classList.add("hidden")
}
}
// Hide SplashScreen
let timeout: number
if (splashScreen && !visible) {
timeout = window.setTimeout(() => {
splashScreen.classList.add("hidden")
}, 3000)
}
return () => {
clearTimeout(timeout)
}
}, [visible])
.hidden {
display: none;
}
splashScreen.style.setProperty("display", "flex")
...
splashScreen.style.setProperty("display", "none")
Hi,
Thank you for your feedback, we appreciate that.
I added a task to our task management system and we will implement this in the next Metronic releases.
Regards,
Lauris Stepanovs,
Keenthemes Support Team