-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.js
31 lines (29 loc) · 878 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
import React, {useEffect} from 'react';
import {Alert} from 'react-native';
import {SafeAreaView, StatusBar} from 'react-native';
import {useStyles} from './src/styles';
import {MapScreen} from './src/screens/mapScreen';
import {readFromStorage, writeToStorage} from './src/utils/localStorage';
const App = () => {
useEffect(() => {
const loadStorage = async () => {
try {
const farmLand = await readFromStorage('farmLand');
if (!farmLand) {
await writeToStorage('farmLand', []);
}
} catch (err) {
Alert.alert('Error', 'An error occured when trying to load storage');
}
};
loadStorage();
}, []);
const styles = useStyles();
return (
<SafeAreaView style={styles.whiteBackground}>
<StatusBar barStyle="light-content" />
<MapScreen />
</SafeAreaView>
);
};
export default App;