-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
36 lines (30 loc) · 931 Bytes
/
App.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import React, { useState, useEffect } from "react";
import AppNavigation from "./navigation/AppNavigation";
import { ImageProvider } from "./provider/ImageContext";
const App = () => {
const [backgroundImage, setBackgroundImage] = useState(null);
const [loading, setLoading] = useState(true);
useEffect(() => {
const loadBackgroundImage = async () => {
try {
const image = require("./assets/bg.png");
setBackgroundImage(image);
} catch (error) {
console.error("Error loading background image:", error);
} finally {
setLoading(false);
}
};
loadBackgroundImage();
}, []);
if (loading || !backgroundImage) {
// You can return a loading indicator or null while the image is loading
return null;
}
return (
<ImageProvider backgroundImageSource={backgroundImage}>
<AppNavigation />
</ImageProvider>
);
};
export default App;