App.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. import 'react-native-gesture-handler';
  2. import React, { useState } from 'react';
  3. import { LogBox } from 'react-native';
  4. import Atlas from './src/components/Atlas';
  5. import { SafeAreaProvider } from 'react-native-safe-area-context';
  6. import { Asset } from 'expo-asset';
  7. import AppLoading from 'expo-app-loading';
  8. const App = () => {
  9. LogBox.ignoreAllLogs();
  10. const [loading, setLoading] = useState(false);
  11. const _cacheResourcesAsync = async () => {
  12. const images = [
  13. require('./assets/logo-white.png'),
  14. require('./assets/cover-dark.png'),
  15. require('./assets/cover.jpg'),
  16. require('./assets/default-pfp.png'),
  17. require('./assets/pothole.png'),
  18. require('./assets/roadblock.png'),
  19. require('./assets/barrier.png'),
  20. require('./assets/bump.png'),
  21. require('./assets/information.png'),
  22. require('./assets/washroom.png'),
  23. require('./assets/park.png'),
  24. ];
  25. const cacheImages = images.map(image => {
  26. return Asset.fromModule(image).downloadAsync();
  27. });
  28. return Promise.all(cacheImages);
  29. }
  30. if (loading) {
  31. return (
  32. <AppLoading
  33. // startAsync={_cacheResourcesAsync}
  34. onFinish={() => setLoading(false)}
  35. onError={console.warn}
  36. />
  37. );
  38. }
  39. return (
  40. <SafeAreaProvider>
  41. <Atlas/>
  42. </SafeAreaProvider>
  43. );
  44. }
  45. export default App